Skip to content

Instantly share code, notes, and snippets.

@yuru4c
Last active June 19, 2018 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuru4c/e36d7400004924fcf7851a7e8ad2b1fe to your computer and use it in GitHub Desktop.
Save yuru4c/e36d7400004924fcf7851a7e8ad2b1fe to your computer and use it in GitHub Desktop.
与えられたフォルダの -0 -D な zip を作成 (bash 必須)
:<<!
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
CALL :mnt "%~0" this
CALL :mnt "%~1" that
bash %this% %that%
EXIT /B
:mnt
SET d=%~d1
SET d=%d:~0,-1%
FOR %%I IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO SET d=!d:%%I=%%I!
SET "pnx=%~pnx1"
SET "pnx=%pnx:\=/%"
SET %2="/mnt/%d%%pnx%"
EXIT /B
!
w() {
for n in "$@"; do
echo "'$n' '*/$n'"
done
}
if [ -d "$1" ]; then
pushd "$1" > /dev/null
eval zip -0 -D -r '"../${PWD##*/}.zip"' . -x `w .DS_Store desktop.ini Thumbs.db`
popd > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment