Jump to content

Backup subdirectory


charlie

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 comment
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 comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...