How to unblock multiple tori in your folder with filenames in terminal
For example, I have 1000 tar files. (n0001.tar ~ n1000.tar) I want to unlock every file in every filename. (contents of n0001.tar in n0001 / folder)
How can I do this in one terminal command?
I agree this command is subject to change.
for F in alcatelS*.tar; do
tar -xvf "$F"
done
+3
nelya9227
source
to share
1 answer
You can use the parameter extension to remove the extension from the filename:
for F in alcatelS*.tar; do
dir=${F%.tar}
( mkdir "$dir" && cd "$dir" && tar -xvf ../"$F" )
done
cd
happens in a subshell (...)
so that the working directory doesn't change for the loop.
0
choroba
source
to share