我想使用robocopy复制目录及其子文件夹。
我不想在根目录中排除一些子文件夹和所有文件。
现在,我将目录复制到不同的作业中,但是我只想要一份作业
$roboOptions = @("/e", "/xo", "/r:2", "/w:2", "/log+:$logFile")
#* Copy to Share2
# &robocopy $buildDrop $copyTargetMaster $roboOptions
#* Copy Share1
&robocopy $buildDrop"\Client" $copyTarget"\Client" $roboOptions
&robocopy $buildDrop"\Database" $copyTarget"\Database" $roboOptions
&robocopy $buildDrop"\dbscripts" $copyTarget"\dbscripts" $roboOptions
&robocopy $buildDrop"\EA" $copyTarget"\EA" $roboOptions
&robocopy $buildDrop"\Jobs" $copyTarget"\Jobs" $roboOptions
&robocopy $buildDrop"\replication" $copyTarget"\replication" $roboOptions
&robocopy $buildDrop"\server" $copyTarget"\server" $roboOptions
我怎样才能做到这一点?
最佳答案
这是我的方法:
@ECHO off
>nul 2>nul robocopy
if errorlevel 9009 (
ECHO ROBOCOPY is not installed.
) else (
ECHO Starting 1-way backup of MEDIA(M:) to BACKUP(G:)...
robocopy.exe M:\ G:\ *.* /E /PURGE /SEC /NP /NJH /NJS^
/XD "$RECYCLE.BIN" "System Volume Information" /TEE /R:5 /COPYALL^
/LOG:from_MEDIA_to_BACKUP.log
ECHO Finished with backup.
)
pause
关于windows - Robocopy参数选项,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9870884/