PDA

View Full Version : xcopy (MS-DOS)



Futterman
07-13-2005, 08:19 AM
Trying to set up the computers at work to automatically backup onto an external hard drive with a batch file called xcopy...

I want it to copy only the "My Documents" folder on the C drive and place it in the "Port 2" folder on the F drive. I have the following line of code saved as "backup.bat" on the desktop (is this a good place to save it?):

xcopy C:\Documents and Settings\user\My Documents F:\Port 2 /E /Y /M

However, when I go to start it up, it opens and closes so fast I can't see what it says (obviously some sort of error message). What's happening?

Few things to note:
-The computer is networked
-The F drive is shared on the network
-OS is Windows 2000

Does anyone know how to get this to work? Hopefully one of the Mikes or Eric are familiar with this program...

Thanks,
Brian

PhilDernerJr
07-13-2005, 09:52 AM
I'd take a stab at taking a screen shot of that error message.

Futterman
07-13-2005, 10:08 AM
Okay, not exactly an error message, but it's up for literally a quarter of a second.


http://www.nycaviation.com/hosting/xcopyss.jpg

Brian

mikephotos
07-13-2005, 01:12 PM
xcopy C:\Documents and Settings\user\My Documents F:\Port 2 /E /Y /M

If you are coping all files in the My Documents folder add a "\*.*" (no quotes) after the My Documents. And same after the Port 2. Shoud look like this:

"xcopy C:\Documents and Settings\user\My Documents\*.* F:\Port 2\*.* /E /Y /M

I'm not real familair with the switches but you could add \S to include subedirectories (e does that too but copies even if empty, \H for hidden files and you might consider \D to check time stamps to see if the file needs to be copied.

Mike

Mike
07-13-2005, 01:34 PM
xcopy C:\Documents and Settings\user\My Documents F:\Port 2 /E /Y /M
The problem is occuring because of the spaces in the directory names. (In response to Mike's post, you shouldn't need to include *.*, as that's implied by using xcopy.) You would need to include the directories in quotation marks, such as:

xcopy "C:\Documents and Settings\user\My Documents" "F:\Port 2" /E /Y /M

However, you may want to look for a free backup solution that runs as a Windows application, so you could run it in the background or do scheduling (though it is possible to schedule DOS commands, that's more trouble than it's worth). You could probably find a freeware one at http://www.download.com.

Hope this helps.

mikephotos
07-13-2005, 01:41 PM
Ah, good catch Mike. I left out the need for the " as I always add them. That certainly was the problem, an important omission on my part. I've always used *.* as a habit, guess it's not really needed.

Mike

Mike
07-13-2005, 01:47 PM
It's cool. :) DOS is way too picky. :-P

moose135
07-13-2005, 01:53 PM
It's cool. :) DOS is way too picky. :-P

Kids these days. I remember back before Windows, when we were glad to have DOS. :P

I'm going to take my abacus and go home now.

Mike
07-13-2005, 03:31 PM
*laughs* My first computer was a 286. 'nuff said. ;)

moose135
07-13-2005, 03:44 PM
*laughs* My first computer was a 286. 'nuff said. ;)

I remember my first one of those - I started on an IBM "XT", even before the x86 days. It even had a color monitor - black with yellow/orange glowing text.

Yes, I know, I'm an old fart. Of course, getting old beats the alternative. :)

Mike
07-13-2005, 04:32 PM
Woah, lol.

True. ;)