Advice on batch script

Soldato
Joined
23 Mar 2007
Posts
2,553
Location
Essex
Evening all

Just looking for some advice on a batch script i am making to backup my movie collection, i'll post below what i have so far

ECHO THE FOLLOWING FILES WILL BE COPIED
XCOPY "D:\My Movies" "F:\My Movies" "\\LIAM-MEDIA\Backup Drive\Movies" /L /D /Y /S
TIMEOUT /T 5
XCOPY "D:\My Movies" "F:\My Movies" "\\LIAM-MEDIA\Backup
Drive\Movies" /S /D /Y

The script worked fine when i only had 1 directory that i was copying from, i added a new HD and created the same folders on them as the previous drive which is why there are 2 "My Movies" locations

It oesnt like the fact of the 2nd directory i have added have i done this wrong? Hope someone could shed some light

Cheers guys
 
You've got 3 locations in each command (I assume 2 sources and a target), xcopy can only cope with a single source and a single target.

You need to have 2 xcopy commands, one to backup d:\My Movies and one for f:\My Movies.
 
Thanks for that mate i though that might be the case, your right the way its setup is 2 source and 1 target. I'll just get the 2nd source to run striahgt after the 1st source has been copied

Thanks again mate
 
May be worth looking at copying the files to both locations in parallel (if D: drive reads a lot faster than F: writes) for efficiency. You could do this by using START to trigger a secondary batch file or something along those lines.
 
May be worth looking at copying the files to both locations in parallel (if D: drive reads a lot faster than F: writes) for efficiency. You could do this by using START to trigger a secondary batch file or something along those lines.

Unless he's got a badass raid in place, this is unlikely to be the case.

Personally, I use robocopy for doing this task, it seems cleaner and better. Plus gives you a better log.


Robocopy /e "c:\source folder" "d:\destination folder"
 
Unless he's got a badass raid in place, this is unlikely to be the case.

Personally, I use robocopy for doing this task, it seems cleaner and better. Plus gives you a better log.


Robocopy /e "c:\source folder" "d:\destination folder"

This = WIN!
 
Cheers for all your help guys, might look to robocopy in the future but always find myself using xcopy for some odd reason. Here is the final script, its a little overkil for what it actually does but it flows nice so i can see whats going to be copied etc before hand

@Echo OFF

ECHO -------------------------------------
ECHO WELCOME TO THE MEDIA BACKUP WIZARD
ECHO -------------------------------------
TIMEOUT /T 5

ECHO ----------------
ECHO MY PICTURES BACKUP
ECHO ----------------

ECHO THE FOLLOWING FILES WILL BE COPIED
XCOPY "D:\PICTURES" "\\MEDIA\Backup Drive\PICTURES" /L /D /Y /S
XCOPY "D:\PICTURES" "\\MEDIA\Backup Drive\PICTURES" /S /D /Y
ECHO.

ECHO THE FOLLOWING FILES WILL BE COPIED
XCOPY "F:\PICTURES" "\\MEDIA\Backup Drive\PICTURES" /L /D /Y /S
XCOPY "F:\PICTURES" "\\MEDIA\Backup Drive\PICTURES" /S /D /Y
ECHO.

ECHO ---------------------
ECHO MY MUSIC BACKUP
ECHO ---------------------

ECHO THE FOLLOWING FILES WILL BE COPIED
XCOPY "D:\MY MUSIC" "\\MEDIA\Backup Drive\MY MUSIC" /L /D /Y /S
XCOPY "D:\MY MUSIC" "\\MEDIA\Backup Drive\MY MUSIC" /S /D /Y
ECHO.

ECHO THE FOLLOWING FILES WILL BE COPIED
XCOPY "F:\MY MUSIC" "\\MEDIA\Backup Drive\MY MUSIC" /L /D /Y /S
XCOPY "F:\MY MUSIC" "\\MEDIA\Backup Drive\MY MUSIC" /S /D /Y
ECHO.
 
Last edited:
Back
Top Bottom