views:

167

answers:

2

Hi All,

Im only new to liux commands and spend most of my time in VB, after searching the web its hard to find a solution in google.

Anyway...... Everyday I backup my Shares folder and ends up being 183 GIG, I tried many ways of backing it up and come to the conclusion that using rar was the best option for my enviroment. So this is the command I use

./rar a -v1g -m0 -ow -ag[dd-mm-yy] Shares "/shares" The resault I get is allot of part files "Shares[15-07-09].part01.rar" which is fine.

What I really want to do now is to backup each folder within the shares directory, so I get something like...

Folder1[15-07-09].part01.rar Folder2[15-07-09].part01.rar Folder3[15-07-09].part01.rar

Well I hope you guys can help with a simple script that I should be able to understand.

Regards, Nathum

+1  A: 
cd /shares ; find . -type d -maxdepth 1 -exec rar a -v1g -m0 -ow '-ag[dd-mm-yy]'  '/backupdir/{}' '{}' ';'

The find command searches for directories (-type d) non-recursively (-maxdepth 1) in "/shares" and executes (-exec) the rar command. The '{}' is replaced by the name of the directory found. I'm not sure about all your rar switches but if the command below works then the find command should do what you want:

rar a -v1g -m0 -ow -ag[dd-mm-yy] /backupdir/Folder1 /shares/Folder1
p00ya
A: 

This is what I ended up with.

cd /BackupServer/WNGLX2/ ; find /shares -maxdepth 1 -type d -printf "%P\n" |xargs -i /BackupServer/WNGLX2/rar a -v1g -m0 -ow -ag[dd-mm-yy] {} /shares/{} \;