Created
August 22, 2020 06:43
-
-
Save ktkr3d/ddfd574f4a8e956dafa667bd182cdab8 to your computer and use it in GitHub Desktop.
ファイルのタイムスタンプ(YYYYMMDD-hhmmss)をファイル名の先頭に追加する。
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/bash | |
mkdir -p renamed | |
while read -d $'\0' file; do | |
file=`echo "${file}" | sed 's!^.*/!!'` | |
timestamp=`date "+%Y%m%d-%H%M%S" -r "${file}"` | |
mv "${file}" ./renamed/${timestamp}_"${file}" | |
done < <(find . -mindepth 1 -maxdepth 1 -type f -print0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment