How could I untar all .tar files in a directory to folders based on filename of each .tar? -
i .zip
files in folder using command below:
for f in "!"; unzip -d "${f%*.zip}" "$f"; done
the above command extracts .zip
files in given folder subfolders, having content , name of respective .zip
files.
but couldn't find command same .tar
files. please help.
btw, trying on remote server using winscp/putty. so, cannot use gui software. need command, question.
after bit of fiddling came for f in $(find -maxdepth 1 | grep .tar); mkdir ${f%.tar}; tar -xaf $f -c ${f%.tar} ; done
appears work, long file name not contain spaces. assume wanted directory foo.tar
named foo
(no file extension). if want directory named foo.tar
(with file extension) try using for f in $(find -maxdepth 1 | grep .tar); mkdir $f ; tar -xaf $f -c $f ; done
. iirc, remote access client cyberduck can handle compressed files in gui - can try if you're fine gui solution.
Comments
Post a Comment