Jump to content

Backup subdirectory


Recommended Posts

I wish to make a tar file to back up the contents of a subdirectory, but I wish to omit one or two files. I used the -x switch to exclude the files, but it did not work. Can someone provide the correct syntax to solve my problem?Charlie :(

Link to post
Share on other sites

CharlieLeaving files out of a compressed archive is done with --exclude !It is as follows, you have to cd to the directory first where the subdirectories are:< cd /usr >< tar -cvzf backup.tar.gz /local --exclude /bin >This will make a .tar.gz file named ¨backup.tar.gz¨ of your /usr/local directory leaving the /usr/local/bin directory out. For more info: < tar --help >< tar -cvzf backup.tar.gz /local /doc /etc /java /bin > or any other file you put after the name of the .tar.gz file will be included in the package, you can put as many as you want with just a space in between.( regular expressions do NOT work with tar ):( Bruno

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...