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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to exclude a sub-directory from tar 1

Status
Not open for further replies.

warrenliang

IS-IT--Management
May 3, 2004
117
US
Hello,

I would like to exclude a sub-directory from tar. Just could not get the correct syntax done.

Like to backup /users/filed directory but exclude /users/field/patch1 subdirectory.

# cd /buffer
# cat excludeme
patch1
# tar cvfX field.tar excludeme /users/field
...
a /users/field/.sh_history 1K
a /users/field/patch1/ 0K
a /users/field/patch1/profile 2K
a /users/field/patch2/ 0K
a /users/field/patch2/profile 2K
...

O/S: Solaris 9

Thanks in advance,

Warren
 
The following command works for me:

# cd /users/field
# tar cvfX /buffer/field.tar ./excludeme *
a ... /OK
a ... /OK
a patch1 excluded
a ... /OK
...
where file excludeme contains on record
patch1

Have a ncie day,
Waren
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top