How would I be able to compress subdirectories into separate archives? Example: directory subdir1 subdir2 Should create subdir1(.tar).gz and subdir2(.tar).gz Go to your expected directory . The grep -v excludes the current directory which will show up in the find command by default. --remove-files will remove source files with directory. for dir in `find . -maxdepth 1 -type d | grep -v "^\.$" `; do tar -cvzf ${dir}.tar.gz --remove-files ${dir}; done