Tar backup
Hi all.
I have a server that holds alot of important data, but is also used for people to dump files on. I have a weekly backup that runs on the server and backs the share up to a tar file on a seperate drive. Because of the not so important stuff people are uploading, it is filling the drive. Is there a way I can specify which folders to add to the tar directory? I really don't want to have to back up 30 or 40 folders one by one. Thanks alot. Regs Craig |
Code:
tar czf example.tar.gz /directory1 /directory2 /directory3 |
There's also an --exclude option and --exclude-from <file> where <file> would have a list of directories to exclude. This assumes you're using GNU tar.
|
Thanks alot guys!!! Sorry about the long delay.
With the -exclude-from way, I don't suppose there is a way to have a file like that, but an include file? So I can put the folders that I want backed up in there? So any other files that are added are just ignored and not backed up? Thanks alot. Craig :) |
Code:
-T, --files-from=NAME get names to extract or create from file NAME Tink |
Hi Tink,
Sorry about this, just so I understand correctly.... tar -cf --files-from=filestobackup.txt /tarfile.tar And inside of filestobackup.txt would be like the below?... ---------------------------------------------- /root/secret.txt /home/johndoe /etc /var/www --------------------------------------------- And that would create a backup of those files, and then allow me to extract them to where they originally were? Thanks for your help. >Craig :) |
Quote:
though ... the 'f' in '-cf' wants its argument immediately, so the --blurb is not quite what it expected ... I'd do tar -T filestobackup.txt -czf tarfile.tgz Quote:
Cheers, Tink |
Thanks Tink :)
|
All times are GMT -5. The time now is 03:07 AM. |