Use tar to pack each directory into seperate file
It's easy.
Batch pack
This one will pack and compress each directory into separate tar.gz file.ls | awk '{ print "tar zcvf "$0".tar.gz " $0|"/bin/bash" }'
If you do not wish to compress it, just pack the directory into file, use this one.ls | awk '{ print "tar cvf "$0".tar " $0|"/bin/bash" }'
Batch unpack
For tar.gz files:for i in $(ls *.tar.gz);do tar xzvf $i;done
For tar files:for i in $(ls *.tar);do tar xvf $i;done
Notes
If you do not wish command printing every file it processed, just want it to do things quietly, remove option v
in those commands.
Reference
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。