Skip to content

Instantly share code, notes, and snippets.

@wwwins
Last active October 4, 2022 08:50
Show Gist options
  • Save wwwins/ff1f7ebb728a1d65c9cdc73797568e67 to your computer and use it in GitHub Desktop.
Save wwwins/ff1f7ebb728a1d65c9cdc73797568e67 to your computer and use it in GitHub Desktop.
Compress all subfolders to separate files
// without hidden folders
for f in $(ls -d */);
do
echo "zip -r -X ${f:0:-1}.zip $f"
done
// include hidden folders
for f in $(ls -Al | awk -F" " '/^d/ {print $9}';
do
echo "zip -r -X $f.zip $f"
done
// forder name with spaces
find * -maxdepth 0 -type d -exec zip -r -X {}.zip {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment