就9楼代码而言,我认为13楼给的建议非常好,但用xcopy直接实现我确实不知怎么办。楼主的要求是保留批处理当前目录的所有目录及子目录以及jpg、gif文件。
如何用xcopy只复制指定后缀的文件还请兄不吝赐教。
曾经尝试过用xcopy /t /e 来构建目录树,但发现如果目标目录也在批处理当前目录时会提示“不能执行周期性复制”的错误。
zpz0012005 兄曾给过一个 xcopy 的代码,但如果“目标目录”在“某文件夹具体路径”里时会提示“不能执行周期性复制”
@echo off
set src=某文件夹具体路径
set dst=目标目录
for %%a in (jpg gif) do xcopy /s/e/c "%src%\*.%%a" "%dst%\"
Last edited by 26933062 on 2009-4-7 at 05:32 ]
Regarding the code on floor 9, I think the suggestion from floor 13 is very good, but I really don't know how to achieve it directly with xcopy. The owner's requirement is to keep all directories and subdirectories in the current directory of the batch and the jpg and gif files.
Please kindly give advice on how to use xcopy to copy only files with specified extensions.
I once tried to use xcopy /t /e to build the directory tree, but found that when the target directory is also in the current directory of the batch, an error "Periodic copy cannot be executed" is prompted.
Brother zpz0012005 once gave a code of xcopy, but when the "target directory" is in "the specific path of a certain folder", an error "Periodic copy cannot be executed" is prompted
@echo off
set src=The specific path of a certain folder
set dst=Target directory
for %%a in (jpg gif) do xcopy /s/e/c "%src%\*.%%a" "%dst%\"
Last edited by 26933062 on 2009-4-7 at 05:32 ]