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

Does tar have folder depth control on extract?

Status
Not open for further replies.

thedaver

IS-IT--Management
Jul 12, 2001
2,741
US
I having a brain fart over using 'tar' and keep thinking like 'patch'.

Doesn't tar have a parameter that says to NOT restore all levels of the folder hierarchy stored in the archive?

For instance,
IF archive has file "/usr/local/test/data.txt"

And chdir to "/usr/local/"

Can't I tell 'tar' to extract "test/data.txt"

I'd swear that's possible, but brain farts being what they are......

D.E.R. Management - IT Project Management Consulting
 
You can use the -A option to suppress the leading "/" (if present) which would allow you to restore to an alternate location, but I'm not aware of a way to suppress a given number of leading characters or sub-directory levels.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top