我需要能够根据文件的修改日期将照片从源文件夹复制到年份文件夹。
我正在寻找Linux上的bash脚本来执行此操作
答案 0 :(得分:2)
rsync将无法帮助您。您需要bash和一些linux命令:
Bash脚本:
if (input.length == 1 && input[0] >= 48 && input[0] <= 57)
{
//you can change 48 to 49 if you want to exclude 0
}
备注
file=myimage.jpeg
modtime=$(stat --printf=%Y $file)
year=$(date -d @$modtime +%Y)
mkdir -p "$year"
cp "$file" "$year"
循环