Sponsored Content
Top Forums Shell Programming and Scripting Tar extract a multiple directories Post 302946817 by kenshinhimura on Friday 12th of June 2015 03:29:43 PM
Old 06-12-2015
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



Code:
for dir in `ls -d /tarfiles/*/ | sed 's/.$//'`
do
rm -f $dir/*.tar
mv -f $dir*tgz* $dir/
gunzip $dir/*.tgz
#done


for f in `ls -l $dir/*.tar`
#f=`ls -l $dir/*.tar`
do
tar xvf  "$dir/$f"  -C $dir/

 

10 More Discussions You Might Find Interesting

1. BSD

tape drives vs. tar with multiple directories

Hello, I have a little problem with backup & restoring files from tape drive. I am adding 3 directories to my tape, and it is OK: hades# tar -cvf /dev/nsa0 test test1 restore a test a test/level1 a test/myharddisk.img a test1 a test1/level1 a test1/myharddisk.img a test1/test.img a... (1 Reply)
Discussion started by: d3m00n
1 Replies

2. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

3. UNIX for Dummies Questions & Answers

tar, zip multiple separate directories and move the results to another volume

TIA, I'm using FreeBSD 6 I have a series of Directories (A,B,C,...Z). Each directory has files and other directories within it. I want to compress the contents of each top directory into a single file so that I get an archive of each directory (for example, A.gzip) AND and want to move... (5 Replies)
Discussion started by: jccbin
5 Replies

4. Linux

extract glibc-2.3.2.tar.tar

Hi, how can I extract glibc-2.3.2.tar.tar file ? I used tar -xf but does not work. Thank you. (4 Replies)
Discussion started by: big123456
4 Replies

5. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

6. Solaris

How to extract files from a tar file without creating the directories?

Hello all. I have a tar file that contains a number of files that are stored in different directories. If I extract this tar file with -xvf , the directories get created. Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
Discussion started by: gkb
9 Replies

7. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

8. UNIX for Dummies Questions & Answers

Deleting multiple directories inside multiple directories

Hi, Very unfamiliar with unix/linux stuff. Our admin is on vacation so, need help very quickly. I have directories (eg 40001, 40002, etc) that each have one subdirectory (01). Each subdir 01 has multiple subdirs (001, 002, 003, etc). They are same in each dir. I need to keep the top and... (7 Replies)
Discussion started by: kkouraus1
7 Replies

9. 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

10. 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
CPANPLUS::Internals::Utils(3pm) 			 Perl Programmers Reference Guide			   CPANPLUS::Internals::Utils(3pm)

NAME
CPANPLUS::Internals::Utils - convenience functions for CPANPLUS SYNOPSIS
my $bool = $cb->_mkdir( dir => 'blah' ); my $bool = $cb->_chdir( dir => 'blah' ); my $bool = $cb->_rmdir( dir => 'blah' ); my $bool = $cb->_move( from => '/some/file', to => '/other/file' ); my $bool = $cb->_move( from => '/some/dir', to => '/other/dir' ); my $cont = $cb->_get_file_contents( file => '/path/to/file' ); my $version = $cb->_perl_version( perl => $^X ); DESCRIPTION
"CPANPLUS::Internals::Utils" holds a few convenience functions for CPANPLUS libraries. METHODS
$cb->_mkdir( dir => '/some/dir' ) "_mkdir" creates a full path to a directory. Returns true on success, false on failure. $cb->_chdir( dir => '/some/dir' ) "_chdir" changes directory to a dir. Returns true on success, false on failure. $cb->_rmdir( dir => '/some/dir' ); Removes a directory completely, even if it is non-empty. Returns true on success, false on failure. $cb->_perl_version ( perl => 'some/perl/binary' ); "_perl_version" returns the version of a certain perl binary. It does this by actually running a command. Returns the perl version on success and false on failure. $cb->_version_to_number( version => $version ); Returns a proper module version, or '0.0' if none was available. $cb->_whoami Returns the name of the subroutine you're currently in. _get_file_contents( file => $file ); Returns the contents of a file $cb->_move( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_copy( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_mode_plus_w( file => '/path/to/file' ); Sets the +w bit for the file. Returns true on success, false on failure. $uri = $cb->_host_to_uri( scheme => SCHEME, host => HOST, path => PATH ); Turns a CPANPLUS::Config style "host" entry into an URI string. Returns the uri on success, and false on failure $cb->_vcmp( VERSION, VERSION ); Normalizes the versions passed and does a '<=>' on them, returning the result. $cb->_home_dir Returns the user's homedir, or "cwd" if it could not be found $path = $cb->_safe_path( path => $path ); Returns a path that's safe to us on Win32 and VMS. Only cleans up the path on Win32 if the path exists. On VMS, it encodes dots to _ using "VMS::Filespec::vmsify" ($pkg, $version, $ext) = $cb->_split_package_string( package => PACKAGE_STRING ); Splits the name of a CPAN package string up into its package, version and extension parts. For example, "Foo-Bar-1.2.tar.gz" would return the following parts: Package: Foo-Bar Version: 1.2 Extension: tar.gz perl v5.18.2 2014-01-06 CPANPLUS::Internals::Utils(3pm)
All times are GMT -4. The time now is 11:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy