Main Page | Report this Page
Linux Forum Index  »  Linux Miscellaneous Topics 2  »  tar --files-from= and filter files from folders...
Page 1 of 1    

tar --files-from= and filter files from folders...

Author Message
Geir...
Posted: Fri Oct 30, 2009 6:36 am
Guest
Hi,

I want to tar a selection of folders and files from a debian server. To
make it simple I want to use a list of file and foldernames using the
parameters in the subject.

However I need to distinguish between files and folders. Is this
possible using tar's --files-from files list?

Say I have:

/usr/myfolder1 (from where I want to copy all files and subfolders)

/usr/myfolder2 (from where I want to only copy all files starting with
at (no spam) 00* but NO subfolders, if possible)

/usr/myfolder3 (from where I want to copy all subfolders but NO files,
if possible)

Thanks for comments and hints on if the above filtering is possible and
how the resulting file list will look like.

best regards geir
 
Vilmos Soti...
Posted: Fri Oct 30, 2009 10:25 am
Guest
Geir <geir02 at (no spam) gmail.com> writes:

Quote:
I want to tar a selection of folders and files from a debian server.
To make it simple I want to use a list of file and foldernames using
the parameters in the subject.

However I need to distinguish between files and folders. Is this
possible using tar's --files-from files list?

Say I have:

/usr/myfolder1 (from where I want to copy all files and subfolders)

/usr/myfolder2 (from where I want to only copy all files starting
with at (no spam) 00* but NO subfolders, if possible)

/usr/myfolder3 (from where I want to copy all subfolders but NO
files, if possible)

This looks pretty convoluted to solve. I see two possible ways to
accomplish it.

1. Use three separate tars.
2. Build the file/directory list and use the --no-recursion
tar option. You still need this option in option 1 for /usr/myfolder3.

A tip. When experimenting, do something like this:

tar -cvf /dev/null --files-from=...

This will print all the files/dirs tar would consider
but will not actually create the archive.

Vilmos
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sat Nov 28, 2009 12:19 am