Unwanted folder structure created while UNTAR
Problem :
I have 20 files(txt files) under the folder: /a1/a2/a3/ e.g /a1/a2/a3/abc.txt , /a1/a2/a3/abcd.txt , etc I want them to tar+gzip them individually to folder /a1/b1/b2/b3 Also I want to create a final tar of all those files in the folder (/a1/b2/b2/) and name it as "final.tar" My Attempt : Code:
for file in /a1/a2/a3/* final.tar is succesfully created. Problem : When I untar the final.tar file to get the individual tar+gzip files using : Code:
tar -xvf final.tar /a1/b1/b2/a1/a2/a3/ So new directory structure is created inside the target folder. Which I dont want. Help Needed. |
Either switch directories when you add with '-C' or look at the '--strip' option to remove as many elements from the path as you like (assuming GNU tar).
|
All times are GMT -5. The time now is 10:13 PM. |