Zips all files within a containing directory This zips all files in a directory and renames the zip archive according to the name of the existing directory. for i in */; do zip -r "${i%/}.zip" "$i"; done