windows复制文件夹的命令?
发布网友
发布时间:2022-04-22 01:11
我来回答
共2个回答
热心网友
时间:2023-06-24 14:01
不清楚你的实际文件/情况,仅以问题中的说明及猜测为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI
@echo off
rem 将一个指定目录下第二级文件夹的子文件夹拷贝/复制到另一个新的目录里
set #=Any question&set _=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%_% %z%
set "oldfolder=D:\xxx\A文件夹"
set "newfolder=E:\yyy\新文件夹"
if not exist "%oldfolder%" (echo;"%oldfolder%" 未找到&pause&exit)
if not exist "%newfolder%" md "%newfolder%"
if "%oldfolder:~-1%" equ "\" set "oldfolder=%oldfolder:~,-1%"
if "%newfolder:~-1%" equ "\" set "newfolder=%newfolder:~,-1%"
for /f "delims=" %%a in ('dir /ad-h/b "%oldfolder%\" 2^>nul') do (
for /f "delims=" %%b in ('dir /ad-h/b "%oldfolder%\%%~nxa\" 2^>nul') do (
echo;"%oldfolder%\%%~nxa\%%~nxb" --^> "%newfolder%\%%~nxb"
xcopy "%oldfolder%\%%~nxa\%%~nxb" "%newfolder%\%%~nxb\" /y /e /q /h /r
)
)
echo;%#% +%$%%$%/%_% %z%
pause
exit
热心网友
时间:2023-06-24 14:01
ctrl A, ctrl X, 上层, ctrl V即可