# Batch file as scheduled task - help please!



## sumsub (Feb 9, 2012)

Hello

I have over 1,00,000 image files to copy over the network. The image files currently reside on a production server that is used extensively through out the day.

For the copying, I intend to run a batch file that uses XCOPY. Because the number of files is large, I was thinking the best way to do this would be to run a scheduled task every night - this scheduled task would run a batch file to copy files over for a set period - say 6 hours that night. This is something I can set on the scheduled task's advanced properties. The task would run again the next night for 6 hours copying only the files that werent copied over before. I have pasted the content of my batch file below (has local paths now for testing purposes). 

What I am after is feedback on whether this Scheduled Task running for a set time every night is a good approach to copy these files over.

Thanks

------------------------batch file content-----------------------------------------

@echo off
::variables
Set sourcedrive=C:\TestTransfer\filessource
set destinationdrive=C:\TestTransfer\filesdest
set LogPath=C:\logfile\
set LogFileExt=.log
set LogFileName=ArchiveTransfer%LogFileExt%
set MyLogFile=%date%
set MyLogFile=%MyLogFile:/=-%
set MyLogFile=%LogPath%%MyLogFile%_%LogFileName%

set backupcmd=xcopy /c /e /s /r /d /y /i 

%backupcmd% %sourcedrive% %destinationdrive% >> %MyLogFile%

------------------------end of batch file--------------------------


----------



## Squashman (Apr 4, 2003)

We do have bulletin board code tags.

I would look at using Robocopy or Richcopy instead.


----------

