我在c:\ folders目录中有一个文件夹,其中大约6000个子文件夹以不同的编号命名,每个子文件夹还有2个子文件夹,名为“medium”和“thumbs”。
我需要将位于c:\ folders中的名为index.html的文件复制到所有6000个文件夹中,并复制到6000个文件夹中每个文件夹的所有介质和拇指子文件夹中。
我正在尝试构建一些像这样的批处理代码
for /D %%D in ("C:\folders\*.*") do ( pushd "%%~D" copy "index.html" copy "index.html" "medium\" copy "index.html" "thumbs\" popd )但这不起作用。 我究竟做错了什么?
i have a folder in c:\folders directory with around 6000 subfolders named with different numbers and each subfolder has 2 more subfolders called "medium" and "thumbs".
I need to copy a file called index.html which is located in c:\folders into ALL 6000 folders and into all medium and thumbs subfolders of each one of the 6000 folders.
I am trying to build some batch code like this
for /D %%D in ("C:\folders\*.*") do ( pushd "%%~D" copy "index.html" copy "index.html" "medium\" copy "index.html" "thumbs\" popd )but this is not working. What am I doing wrong?
最满意答案
如果它适用于每个子文件夹,这应该可以完成
set "source=full path of index.html" for /f "delims=" %%D in ('dir /b /s /ad "C:\folders\*") do ( copy "%source%" "%%~D" )编辑: 在copy命令行中禁止控制台add >nul中的输出 要不覆盖index.html文件,请用echo n|copy /-y替换copy
set "source=full path of index.html" for /f "delims=" %%D in ('dir /b /s /ad "C:\folders\*") do ( echo n|copy /-y "%source%" "%%~D">nul )http://ss64.com/nt/copy.html
This should do the job if it's for every subfolder
set "source=full path of index.html" for /f "delims=" %%D in ('dir /b /s /ad "C:\folders\*") do ( copy "%source%" "%%~D" )edit: to suppress output in console add >nul in copy command line to not overwrite index.html files, replace copy by echo n|copy /-y
set "source=full path of index.html" for /f "delims=" %%D in ('dir /b /s /ad "C:\folders\*") do ( echo n|copy /-y "%source%" "%%~D">nul )http://ss64.com/nt/copy.html
更多推荐
folders,文件夹,thumbs,html,电脑培训,计算机培训,IT培训"/> <meta name="descr
发布评论