脚本用于将具有结束字符的特定文件从一个目录复制到另一个目录

时间:2015-01-21 09:57:10

标签: windows batch-file command-prompt

我是脚本新手,

我想将特定文件从一个目录复制到目录。

示例:

c:\ website到D:\ website

C:\ website包含:

flower_small.jpg

flower_large.jpg

flowerss_small.jpg

flowerss_large.jpg

我想用' _small.jpg'

复制所有文件的结尾

我要移动大量文件。

你能帮帮我吗?

2 个答案:

答案 0 :(得分:2)

我认为你只需要:

copy c:\website\*_small.jpg D:\website

但是,您确实说过“要移动大量文件”。如果你真的想要移动它们而不是在两个目录中都有文件。然后使用:

move c:\website\*_small.jpg D:\website

答案 1 :(得分:1)

@echo off

setlocal

set "source_folder=c:\website"
set "destination_folder=D:\website"

pushd "%source_folder%"

for %%a in (*_small.jpg) do (
    copy /y "%%a" "%destination_folder%" 
)
popd
endlocal