-   Programming (
-   -   tar --exclude-from=FILE (

GATTACA 07-29-2005 11:42 AM

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:


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?

Quigi 07-29-2005 12:25 PM

In your command, "~" isn't expanded. You told us you mean your home directory, so use either of

--exclude-from ~/.skip_files

As written, .skip_files would need to sit in a local sub-directory by the name "~".

All times are GMT -5. The time now is 10:15 AM.