tar --exclude-from=FILE
I'm trying to get tar to pack up only certain files in a directory.
I my approach is that I have a file in my home space called .skip_files (<- note the dot at the beginnig of name). Anyway lets say a directory contains the following: file1.txt file2.txt avoid1.txt avoid2.txt extra-directory-1 extra-directory-2 avoid-directory-1 I want tar to include in a tarball everything that does not contain "avoid" in its name. Now in ~/.skip_files I've added the names of the files and directories I want to skip When I execute: tar -czvf stuff.tar.gz --exclude-from=~/.skip_files target_directory it never works. I've tried variations of the command such as: tar -czf stuff.tar.gz --exclude-from=~/.skip_files target_directory tar -czf stuff.tar.gz target_directory --exclude-from=~/.skip_files I'm sure there is a simple solution to this problem I just can see it. Any suggestions? |
In your command, "~" isn't expanded. You told us you mean your home directory, so use either of
Code:
--exclude-from ~/.skip_files |
All times are GMT -5. The time now is 07:13 AM. |