0
我需要使用名为process.bat
的蝙蝠来处理某些子目录中的所有jpg文件。
Windows蝙蝠:如何循环子目录中的文件
dir
|---subdir1
| |-----a.jpg
| |-----b.jpg
|
|---subdir2
|-----c.jpg
|-----d.jpg
process.bat dir/subdir1/a.jpg dir/subdir1/b.jpg
process.bat dir/subdir2/c.jpg dir/subdir2/d.jpg
在Linux中,我能做出这样的脚本:
find $1 -type d | while read dir; do
files=("$dir"/*.jpg)
if [ ${#files[@]} -gt 0 ]; then
if ! [[ $files =~ \* ]]; then
process.bat "${files[@]}"
fi
fi
done
但我不知道该怎么做同样的事情在Windows中。
我知道环路如何将文件在Windows蝙蝠:for /r %%i in (*) do echo %%i
https://stackoverflow.com/questions/44402963/windows-bat-loop-files-in-d irectories – Yves
在此链接阅读我的答案。重新编辑一下你的答案可能对其他人更有帮助。 – Yves