-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John French (CIMS) wrote:
| I have a large number of directories in a single directory.  All of the
| subdirectories have a single tar file.  Is there a way to go through each
| directory and extract the files from the tar file into the directory where
| the tar file is located?

How deep are the directories? Sounds like shell script time.

In top level dir:

# Look for everyting
for x in *
	# If directory (can't 'cd' to file)
	do if [ -d $x ]
	then
		# Change to directory
		cd $x
		# Look for all tar files
		for y in *.tar
			# For each tar file, extract
			do tar xvf $y
		done
		# Change back up 1 level
		cd ..
	# End if
	fi
done

Now if it's more than 1 tree deep, you'd have to get a bit more tricky.

HTH,
- -Rick
- --
Rick Johnson, RHCE - [EMAIL PROTECTED] (from home)
Linux/WAN Administrator - Medata, Inc.
PGP Key: https://mail.medata.com/pgp/rjohnson.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+AKCSIgQdhlSHZgMRArXPAJ9kRS8VNDXvWuHwUXslh1phK/yhNwCgnvVV
zahLmUrBoNdB8uceGYX4abU=
=5Lik
-----END PGP SIGNATURE-----



--
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to