Posts Tagged ‘ extract

Tar extract destination folder

Tar can redirect extracted files to a different folder. This can be handy if you want to unpack a tar archive stored on a cd or other read-only media and want to eliminate the step of first copying the archive, extracting it, then deleting the extra tar.  All you have to do is add a ‘-C <target folder>’ to the tar command.   So here’s an example using the Tools tarball:

# tar -C /root -zxvf /media/cdrom0/VMwareTools-8.3.2-257589.tar.gz

This will redirect the extracted files into the /root folder. simple

Batch extract a directory full of split RAR archives “part1″, “part2″

If for some reason you have a directory full of archives, and each is into parts, extracting them individually can be a pain. If you just type “ *” into the terminal, you will each file multiple times depending on how many “parts” it has. First, install the “unrar” package:

sudo aptitude install unrar

then cd to the directory with all of your RAR archives. Then type:

unrar e '*..rar'

make sure to keep the single quotes.
If the rar is password protected, add the “-p” switch followed by the password without any spaces.

unrar e -p
 '*.part1.rar'