Sponsored Content
Operating Systems Solaris How to extract files from a tar file without creating the directories? Post 302460991 by jim mcnamara on Friday 8th of October 2010 07:02:03 AM
Old 10-08-2010
Not really - that is the builtin behavior of tar.

Try this on /var/tmp or /tmp or your home directory (be sure there is disk space beforehand)
Code:
cd /tmp
mkdir junk
cd junk
tar xvf mytarball.tar
cd ..
export DEST=/real/path/to/files
find junk -type -f  |
while read fname
do
     bn=$(basename $fname)
     mv $fname ${DEST}/${fn}
done 
rm -r ./junk

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cant extract files from a tar file

hi everyone i have a tar file which was in AIX box. its 300mb. i cant untar in windowsxp home. I just get an empty folder with no files when i extract. i dont get any bad header or any such error. i am using IZARC which is a freeware. Not sure if i should try winzip or winrar. any help (2 Replies)
Discussion started by: bryan
2 Replies

2. UNIX for Dummies Questions & Answers

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... (4 Replies)
Discussion started by: here2learn
4 Replies

3. Shell Programming and Scripting

extract one file form .tar.gz without uncompressing .tar.gz file

hi all, kindly help me how to extract one file form .tar.gz without uncompressing .tar.gz file. thanks in advance bali (2 Replies)
Discussion started by: balireddy_77
2 Replies

4. UNIX for Dummies Questions & Answers

Creating a Tar file while files are spooling

Hi I have done a search for this but couldn't find much on it. I am creating a tar file with the command below tar cvf /export/home/user/backup/*Will this is being created I have a job spooling to 5 texts files in the following directory /export/home/user/backup/STATS/ The tar files... (1 Reply)
Discussion started by: sgarvan
1 Replies

5. Shell Programming and Scripting

Tar creating copies of files

I am trying to archive directories based on their last modified date. When I tar and compress the directory it makes copies of whats inside, I don't know how to fix this. Here is my code. #!/bin/bash #AUTODRUNDISABLE VERSION="0.2" cd /desired/directory/to/archive find . -type d -newermt... (3 Replies)
Discussion started by: jrymer
3 Replies

6. UNIX for Dummies Questions & Answers

Do I need to extract the entire tar file to confirm the tar folder is fine?

I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it. Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem? tar tvf file1.tar ... (1 Reply)
Discussion started by: vivien_chu
1 Replies

7. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

8. Shell Programming and Scripting

Extract a tar ball into multiple directories

#cat a BAC064DAL BAC063DAL BAC056PHX BAC066DAL BAC062PHX BAC062DAL BAC060DAL BAC058PHX BAC054PHX BAC051PHX # for i in `cat a` > do > tar xvf $a/$a*.tar* > done tar: /*.tar*: Cannot open: No such file or directory tar: Error is not recoverable: exiting now tar: /*.tar*: Cannot... (3 Replies)
Discussion started by: kenshinhimura
3 Replies

9. Shell Programming and Scripting

Tar extract a multiple directories

i extract it through script, is there any way to script or automate to tar extract a tarfiles in multiple directories at once? Cannot open: No such file or directory tar: Error is not recoverable: exiting now for dir in `ls -d /tarfiles/*/ | sed 's/.$//'` do rm -f $dir/*.tar mv -f... (1 Reply)
Discussion started by: kenshinhimura
1 Replies

10. Shell Programming and Scripting

Problem creating a tar ball in different directories

Hi all. I'm hitting a problem creating a tar archive in one directory from files located in a different directory. It fails when I replace the absolute paths with variables in the script but works if I just run tar on the cmdln. E.g. #!/bin/ksh BASE=$PWD STAGE=$BASE/stage LOG=$BASE/log... (4 Replies)
Discussion started by: user052009
4 Replies
SENDFILES(1)							     [nmh-1.5]							      SENDFILES(1)

NAME
sendfiles - send multiple files via a MIME message SYNOPSIS
sendfiles [delay] mailpath subject file1 [file2 ...] DESCRIPTION
The shell script sendfiles, is used to send a collection of files and directories via electronic mail. sendfiles mailpath "subject" files ... sendfiles will archive the files and directories you name with the tar command, and then mail the compressed archive to the "mailpath" with the given "subject". The archive will be automatically split up into as many messages as necessary in order to get past most mailers. Sometimes you want sendfiles to pause after posting a partial message. This is usually the case when you are running sendmail and expect to generate a lot of partial messages. If the first argument given to sendfiles starts with a dash, then it is interpreted as the number of seconds to pause in between postings, e.g., sendfiles -30 mailpath "subject" files ... will pause 30 seconds in between each posting. Extracting the Received Files When these messages are received, invoke mhstore once for the list of messages. The default is for mhstore to store the combined parts as a new message in the current folder, although this can be changed using storage formatting strings. You can then use mhlist to find out what's inside; possibly followed by mhstore again to write the archive to a file where you can subsequently uncompress and untar it. For instance: % mhlist 5-8 msg part type/subtype size description 5 message/partial 47K part 1 of 4 6 message/partial 47K part 2 of 4 7 message/partial 47K part 3 of 4 8 message/partial 18K part 4 of 4 % mhstore 5-8 reassembling partials 5,6,7,8 to folder inbox as message 9 % mhlist -verbose 9 msg part type/subtype size description 9 application/octet-stream 118K (extract with uncompress | tar xvpf -) type=tar conversions=compress % mhstore 9 % uncompress < 9.tar.Z | tar xvpf - Alternately, by using the -auto switch, mhstore will automatically do the extraction for you: % mhlist 5-8 msg part type/subtype size description 5 message/partial 47K part 1 of 4 6 message/partial 47K part 2 of 4 7 message/partial 47K part 3 of 4 8 message/partial 18K part 4 of 4 % mhstore 5-8 reassembling partials 5,6,7,8 to folder inbox as message 9 % mhlist -verbose 9 msg part type/subtype size description 9 application/octet-stream 118K (extract with uncompress | tar xvpf -) type=tar conversions=compress % mhstore -auto 9 -- tar listing appears here as files are extracted As the second tar listing is generated, the files are extracted. A prudent user will never put -auto in the .mh_profile file. The correct procedure is to first use mhlist to find out what will be extracted. Then mhstore can be invoked with -auto to perform the extraction. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
Path: To determine the user's nmh directory Current-Folder: To find the default current folder SEE ALSO
mhbuild(1), mhlist(1), mhshow(1), mhstore(1). Proposed Standard for Message Encapsulation (RFC-934) DEFAULTS
`-noverbose' CONTEXT
None MH.6.8 11 June 2012 SENDFILES(1)
All times are GMT -4. The time now is 02:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy