Create individual tar.gz archive for every directory found in current location

This is how to automatically create individual tar.gz archive for every directory found in current location. Sometimes the whole directory might be too big to archive so I need to go one more level under and create a separate archives for each directory found.

Method 1:

find * -maxdepth 0 -type d -exec tar zcvf {}.tar.gz {} \;

Method 2:

for i in `ls ./`; do tar czvf "$i".tar.gz "$i" ; done

References, Sources and Credits:





Comments

Popular posts from this blog