LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how do i add a folder into a rar archive (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-add-a-folder-into-a-rar-archive-507825/)

steve51184 12-05-2006 11:28 PM

how do i add a folder into a rar archive
 
hi there i have a fedora core 4 server that i control throw ssh

my question is how do i add a folder (with sub folders and files in it) to a rar archive?

i have rar from rarlabs.com but can't find anywhere what the command is?


p.s. i'm not a n00b but rather just a confused linux user (in linux i use ark but throw ssh/command-line i have no idea)

unSpawn 12-06-2006 05:37 AM

Type "which rar" to find the command, type "rar a -r /some/dir /some/archive.rar" to recursively add files.

z-vet 12-06-2006 12:10 PM

Why rar on Linux?

matthewg42 12-06-2006 12:35 PM

rar is not a commonly used archive format on Linux. There are a few command line tools for handling rar files, but they aren't very feature rich.

Not sure about other distros, but Ubuntu carries a few implementations for rar processors:

unrar-free (universe repo). This is a GPL'd program which can extract rar archives. It has quite limited functionality.

rar and unrar (multiverse repository). Command line tools with some more features, but not under a free license. I seem to remember something about shareware and having to register after so many uses, but I might be wrong there.

Penguin of Wonder 12-06-2006 12:45 PM

tar and zip are much better alternatives in Linux. Especially if you plan on distributing your archive to multiple people.

matthewg42 12-06-2006 01:01 PM

For single files bzip2 gives very good compression. You can archive lots of files together in a .tar file, and then compress that using bzip2 to get good compression ratios. GNU's implementation of tar will do this all in one operation is you use the j option, e.g.
Code:

tar cjf myarchive.tar.bz2 files and directories to add ...
The only down side to using tar files over zip or rar, is that there is no "table of contents" written at the start (or end - whatever) of the file. This means that to get a listing of the contents of a tar file, the program needs to read through the whole file, which for large tar files can take a long time.

Apart from this (in fact partly because of it), tar files can do things zip and rar files aren't suitable for - they can be used on non-random access devices such as tape drives - tar stands for tape archive). tar files can also contains multiple versions of a file with a given name, and you can choose which one to restore from the archive.

Having said all that, if you're not in control of the formats (e.g. you're administering a website which distributes rar files for windows users), the coolness of tar archives doesn't help you much. HO hum.

unSpawn 12-06-2006 04:27 PM

rar is not a commonly used archive format on Linux.
..is an argument against, what?


There are a few command line tools for handling rar files, but they aren't very feature rich.
Where do you get that from?
Code:

rar.exe | grep ^RAR | gawk "{print $2}"
3.41
rar.exe | wc -l
106

rpm -q --queryformat "%{version}" rar
3.51
\rar | wc -l
102

As feature-rich as its Wintendo console cousin. (running "rar" w/o args shows help on switches)


Apart from this (in fact partly because of it), tar files can do things zip and rar files aren't suitable for
RAR OTOH can manage compression (sort of like Bzip2 does), retain DAC rights, use passwords, archive files before or after a certain date, create volumes, add recovery data and then some. And all that w/o external helper apps, unlike tar.


All times are GMT -5. The time now is 12:27 PM.