Skip to content

Instantly share code, notes, and snippets.

@shoarai
Created September 29, 2022 10:34
Show Gist options
  • Save shoarai/2d1c1a3dd900839780674d5027746ccb to your computer and use it in GitHub Desktop.
Save shoarai/2d1c1a3dd900839780674d5027746ccb to your computer and use it in GitHub Desktop.
#!/bin/bash
# d2zip zips each of all folders directly under
# the d folder in the same folder as the d2zip.sh.
# e.g.)
# .
# ├── d2zip.sh
# └── d/
# ├── folderA/ -> ziped to folderA.zip
# └── folderB/ -> ziped to folderB.zip
ROOT=d
set -eu
cd "$(dirname "$0")"
cd ./$ROOT
IFS=$'\n'
for f in *; do
zip -r $f.zip $f
done
echo "Succeed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment