小编Pri*_*yam的帖子

使用批处理文件将文件从内部目录递归复制到外部

有这个目录结构:

Dir1
--Dir2
    --File1
    --File2
--Dir3
    --File3
--File4
--File5
Run Code Online (Sandbox Code Playgroud)

现在我想使用批处理文件将子目录(Dir2,Dir3)中的所有文件复制到父目录Dir1.我已经提出了下面的代码,但它并不完美.我得到以下输出 -

Directory2             --It has 4 files all together
Invalid number of parameters
Invalid number of parameters
Does E:\Directory1\Copy\File1.dat specify a file name   -- And only this file gets copied
or directory name on the target
(F = file, D = directory)?
Run Code Online (Sandbox Code Playgroud)

代码 -

@echo off
call :treeProcess
Pause
goto :eof

:treeProcess
rem Do whatever you want here over the files of this subdir, for example:
for /D %%d in (*) …
Run Code Online (Sandbox Code Playgroud)

recursion xcopy batch-file

0
推荐指数
1
解决办法
6318
查看次数

标签 统计

batch-file ×1

recursion ×1

xcopy ×1