这就是我现在所拥有的
#!/bin/bash
# This would match files that begin with YYYYMMDD format.
files=([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]*)
# If you want to match those in the current year, start it with that year instead.
# current_year=$(date +%Y)
# files=("$current_year"[0-9][0-9][0-9][0-9]*)
#expands its values to multiple arguments "${files[@]}"
for file in "${files[@]}"; do
file_year=${file:0:4}
# Adding -p option to mkdir would create the directory only if it doesn't exist.
mkdir -p "$file_year"
file_month=${file:4:2}
mkdir -p "$file_month”
mv "$files" "$file_year"/"$file_month"
done
出现错误 第 19 行:在寻找匹配的 `"' 时出现意外 EOF 第 22 行:语法错误:文件意外结束