Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Robocopy in an Array with Logging

$
0
0
The code below will run Robocopy without the Windows Command Shell and aggregate all three backups into one log file with the use of the carets (>).

A single caret creates a new log. Double carets append to the log.

If using single carets with the same log name, only the last backup will be logged as it'll be overwritted with each reiteration.

If different log names are used with each backup, there'll be three separate logs when using single carets throughout.

All three backups aggregated into on log file
> backup.log
>> backup.log
>> backup.log

Individual log files
> backup1.log
> backup2.log
> backup3.log

Best to use short file names with robocopy.

Help -> FileGetShortName

Robocopy is installed with Windows 7, can't speak for XP.

[ autoit ]      
Dim $aArray[3] $aArray[0]="robocopy C:\PROGRA~1\ABC\Data\Archive E:\Backups\ABC /MIR /W:5 /FFT /Z /NP > ""C:\Apps\Backups\Logs\ABC Backup.log""" $aArray[1]="robocopy C:\PROGRA~1\ABC\Data\Archive C:\Backups\ABC /MIR /W:5 /FFT /Z /NP >> ""C:\Apps\Backups\Logs\ABC Backup.log""" $aArray[2]="robocopy C:\Apps\Utils E:\Apps\Utils /MIR /W:5 /FFT /Z /NP >> ""C:\Backups\Logs\ABC Backup.log""" FOR $locA IN $aArray Run(@ComSpec & " /c " & $locA, @SystemDir, @SW_HIDE) ProcessWaitClose("cmd.exe") Next

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>