1.

Solve : Creating a .bat backup program not working?

Answer»

I am trying to execute a backup PROGRAM using notepad then saving the file as a .bat so the at it will execute / run the backup program to save my content to another hard drive. I tried the original code and it WORKED fine it transferred the content in c:\testsource to c:\testbackup when i try to change the destination folder to another folder and tried the program again it did not transfer the content in c:\testbackup to the other folder. Can somebody show me what i am doing wrong.

@echo off
xcopy c:\testsource c:\testbackup /m /e /yWhats the folder you are trying to change it to?

And by the way, it would not transfer the content in 'c:\testbackup' to the other folder UNLESS you had that as the source which is currently 'c:\testsource'? Make sure either this was a typo or you might be doing it backwards. The xcopy DOS command to copy all contents of the c:\testsource directory to the c:\testbackup.

XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.

/M Copies only files with the archive attribute set, turns off the archive attribute.
/E Copies directories and subdirectories, including empty ones.
/Y Suppresses prompting to confirm you WANT to overwrite an existing destination file.

You might be having issue with the directory length and/or spacing.If any folder name contains spaces it must be enclosed in quotes. Thank you Azzaboi and BC_Programmer for your tips it worked out.Quote from: alyoob on February 28, 2010, 05:11:22 PM

Here is the folder that i want to transfer to C:\Documents and Settings\HP_Owner\My Documents\My MUSIC
should there be quotes because and you show me how to type it.

Code: [Select]xcopy c:\testsource "C:\Documents and Settings\HP_Owner\My Documents\My Music" /m /e /y

if your source folder also contains quotes you'll need to place quotes around it in the same manner.


Discussion

No Comment Found