Skip to content

How to Create Tar Archives for Each Folder in a Directory

Follow commands create tar archives folder by folder into their own tar - so folder becomes folder.tar

Compressed archive

Terminal window
find . -type d -maxdepth 1 -mindepth 1 -exec tar zcvf {}.tar.gz {} \;

Un-coompressed archive

Terminal window
find . -type d -maxdepth 1 -mindepth 1 -exec tar cvf {}.tar {} \;