Last active
February 11, 2019 06:04
-
-
Save oshiro-kazuma/4b37c51a7a993d10ad2b08fac7619462 to your computer and use it in GitHub Desktop.
画像ファイルをファイル名でソートしてZIPする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
set -eu | |
# usage ./sortzip.sh target_dir | |
# | |
# example: ディレクトリを丸ごとzip化 | |
# ls -d */ | xargs -I{} ./sortzip.sh {} | |
TARGET_DIR=$(echo $1 | tr -d '/') | |
echo "target dir: ${TARGET_DIR}" | |
find "${TARGET_DIR}" -type f -print0 | sort -z | xargs -0 zip -@rjDo0 "${TARGET_DIR}.zip" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment