How to archive multiple directories with rar?

Hello,

How can I archive all directories using rar.

Example:

In directory /home/dir I have:

Jonh/
Back/
EXM1/
D.23/

And more 50 directories... I need to do: " rar a -v100m -R Jonh.rar /home/dir/John" for each directory  :/

How can I archive all directories with one script or something.

Thanks a lot :).
rosanme1Asked:
Who is Participating?
 
MikeOM_DBAConnect With a Mentor Commented:

You could try this:


rar a -v100m -R John.rar'/home/dir/*'

Open in new window

0
 
tty2Connect With a Mentor Commented:
If you want to create separate archive for each directory in /home,

cd /home/dir; for i in *; do rar a -v102400k -r /path/to/arch/$i.rar $i/*; done
0
All Courses

From novice to tech pro — start learning today.