troubleshooting Question

Delete Original TAR Files After UNTAR

Avatar of Paul_Jay
Paul_JayFlag for United States of America asked on
Unix OSSystem Programming
3 Comments1 Solution6014 ViewsLast Modified:
I am running this command on HP UNIX.  I have 60 tar files that contain multiple files totaling about 2GB of data in each tar file.  The following command is working fine to extract the files.  The issue is I don't have enough disk space for all the .tar files and the .dat files it contains to exist at the same time.  I want to extract data from FILE1.tar to FILE1A.dat, FILE1B.dat and then delete FILE1.tar before moving on to file FILE2.tar.  Is there a way to automatically delete the .tar file once the data has been extracted to the .dat file?  

for tarfile in *tar;  do tar -xvf $tarfile; done

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros