![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to extract files one by one from a directory and let some processing happen | saniya | Shell Programming and Scripting | 7 | 05-23-2008 03:58 AM |
| tar extract to different directory | ammu | UNIX for Advanced & Expert Users | 1 | 07-25-2007 07:54 AM |
| creating object files in a specific directory | svh | High Level Programming | 1 | 02-13-2006 03:05 PM |
| How to extract archive to a specified directory | john_trinh | UNIX for Dummies Questions & Answers | 4 | 03-02-2004 03:07 PM |
| redirecting tar extract to another directory | colesy | UNIX for Dummies Questions & Answers | 7 | 01-28-2003 01:40 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
extract tar files without creating directory
I received a tar file of a directory with 50,000 files in it. Is it possible to extract the files in the tar file without first creating the directory?
ie. Doing tar -xvf filename.tar extracts as follows: x directory/file1.txt x directory/file2.txt . . . I would like to avoid the creation of "directory", otherwise I have to move the files when the process is complete. Thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
tar- is used to create a single file out of a collection of directories and files.So,you will always get the same contents(as the original one when the tar was created) when you untar it .Because the whole directory structure and the contents are recorded as a stream of bytes in your tar file.So, I think there is no other go!!!
__________________
--> Rakabarp Nastor |
|
#3
|
||||
|
||||
|
One way is via pax. I created directory called tartest and populated it with a few files. The I did:
tar cvf tartest.tar tartest This results in a tar archive with files in a directory called tartest. I can restore this with pax via: pax -r -dv -f tartest.tar But if I want to restore the files directly into my current directory, I can do: pax -r -f tartest.tar -s'/tartest\///' Before you try something like that, do this... "pax -dv -f tartest.tar" is like "tar tvf tartest.tar". It just lists the contents of the tar archive. Now do: pax -dv -f tartest.tar -s'/tartest\///p' and look at the results. This way you can be sure that you have the -s argument right before you try the restore. |
|
#4
|
|||
|
|||
|
Awesome Perderabo.
Thanks so much for the reply. |
|
#5
|
|||
|
|||
|
Quote:
|
|||
| Google The UNIX and Linux Forums |