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

how to tar a series of directories with exclusions 1

Status
Not open for further replies.

Nerdhurd

Technical User
Jan 11, 2005
57
US
Howdy folks, is there a way to tarball a series of directories while exluding a directory? Id like to

tar -cvzf archive.tgz home/username/basedir

I want to exclude a directory within basedir called: test

is there a way to do this?

Thanks!
 
Thanks, sorry I did try that previously but for whatever reason the directory was still being tarballed:

tar -cvzf archive.tgz home/username/basedir -exclude /home/username/basedir/test/*

 
According to man tar, the syntax is [tt]--exclude=file[/tt] .
 
--exclude is pretty much a pattern, handy for '.*' to exclude dotfiles, but works on the global path text. GNU tar at least.

--exclude=PATTERN
exclude files matching PATTERN


. Mac for productivity
.. Linux for developement
... Windows for solitaire
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top