我想使用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
我该怎么做?
答案 0 :(得分:1)
我是这样做的:
@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