将所有 *.512.png 移动到新文件夹的脚本
Script for moving all *.512.png to a new folder
你能制作一个脚本(bash) 来将所有以 *.512.png 结尾的文件移动到一个新文件夹,例如 res512(将是新分支)(保留所有子文件夹)
对于 this repo 我试了很长时间,但我想不通。
你问的不是很具体。
如果要将所有后缀为 .512.png
的文件从 当前目录 移动到新目录,可以使用以下命令
mkdir res512
cp -r *.512.png res512/
如果要将目录中 的所有后缀为 .512.png
的文件和所有子目录 移动到新目录中,可以使用
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
如果要将所有后缀为 .512.png
的文件及其目录结构 移动到新目录中,可以使用
find . -name '*.512.png' -exec cp --parents \{\} res512/ \;
Replace cp
with mv
if you want to move the files instead of copy them.
你能制作一个脚本(bash) 来将所有以 *.512.png 结尾的文件移动到一个新文件夹,例如 res512(将是新分支)(保留所有子文件夹) 对于 this repo 我试了很长时间,但我想不通。
你问的不是很具体。
如果要将所有后缀为 .512.png
的文件从 当前目录 移动到新目录,可以使用以下命令
mkdir res512
cp -r *.512.png res512/
如果要将目录中 的所有后缀为 .512.png
的文件和所有子目录 移动到新目录中,可以使用
mkdir res512
for f in $(find -type f -name "*.512.png")
do
cp $f res512/
done
如果要将所有后缀为 .512.png
的文件及其目录结构 移动到新目录中,可以使用
find . -name '*.512.png' -exec cp --parents \{\} res512/ \;
Replace
cp
withmv
if you want to move the files instead of copy them.