Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tar file ?

Status
Not open for further replies.

EBee

MIS
Aug 10, 2001
229
US
how can i TAR a file with some file restrictions.

I have a

/sbherm/app/Loginserver/Swd/Users
ETORRES/
ESMITH/
EBOB/
AUSERS/. . . . . . .

in each of this DIR under Users has a .prp files.

/sbherm/app/Loginserver/Swd/Users tar -cvf users.tar/Users

what can I add in the command line so i don't tar the *.prp files within each individual users directory

thanks
erwin
 
Standard tar doesn't offer a direct way to do that, but you can accomplish it by something like this:

find . ! -name '*prp' > /tmp/usethese
tar cvfF /dev/rct0 /tmp/usethese

Other tars (most notably the supertars: ) offer easier methods, such as using an "exclude" file.





Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
thanks for the response, I am a newbie in UNIX, can you explain what happens when i do

find . ! -name '*prp' > /tmp/usethese
tar cvfF /dev/rct0 /tmp/usethese

does this mean that the *.prp files goes to a tmp folder before it TAR's it. and what happens to the original files when i do this. I do not want to make any changes to the Users DIR. I just wanted to TAR (copy) it so it won't be too big to move to a different location. then i gzip it so i can move it again to a NT server location.

thanks
erwin
 
The "find" merely lists files that are NOT *.prp and stores the names in another file ("> /tmp/usethese")

The "F" argument to tar tells it to archive the files listed in that file.

A simple reading of "man find" and "man tar" might have saved you waiting for an answer.

I'd suggest you really need a basic Unix book: lists some good starting books.

Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top