Another MS DOS batch file need (1 Viewer)

ajetrumpet

Banned
Local time
Yesterday, 19:19
Joined
Jun 22, 2007
Messages
5,638
I need some experienced MS DOS help here please:

I am not proficient with writing batch files, and I need to get one put together. Here is what I currently do every week to copy my parent directory to a USB from my hard disk:
Code:
xcopy c:\users\adam/s f:\adam
Before this though, I have to delete everything off of my USB because the copied files need to overwrite everything already on the USB, and I don't want to be bothered by a million "overwrite" confirmations. This process takes about 15 minutes in DOS, and that is fine with me, but I'm hoping to automate it somewhat.

I'm not the best at DOS, so if I could get some guidance with the following batch file proposal, I'd appreciate it:

1) Schedule a task every week at a certain time
2) Prompt for insertion of the F: drive device (with an optional to cancel the operation)
3) Run a batch file that performs what I already do, but overwrites the old files wo/any prompts


I can only do #1 (obviously). Thank you for any assistance...
 
Local time
Yesterday, 19:19
Joined
Mar 4, 2008
Messages
3,856
In a text editor:

Code:
Echo off
cls
Echo Please insert the drive F: device.  (Press <ctrl> C to cancel).
pause
xcopy c:\users\adam f:\adam /Y /s

Save it as a .bat or .com file. Point to it in your task.
 
Last edited:

ajetrumpet

Banned
Local time
Yesterday, 19:19
Joined
Jun 22, 2007
Messages
5,638
maybe I just should have looked here for that, huh? Guess it's not too difficult. :rolleyes: thanks!
 

ajetrumpet

Banned
Local time
Yesterday, 19:19
Joined
Jun 22, 2007
Messages
5,638
works fine george...the only thing is the message at the beginning:

cannot find the specified file. All files are overwritten, but still get the message during the run. is it the folder it is talking about? Here is the file that I am testing right now:
Code:
Echo off
cls
Echo Please insert the drive F: device.  (Press <ctrl> C to cancel).
pause
xcopy c:\users\adam\irs/s f:\irs/y
I get no message that pops up. about the insertion. I will try and see if I can get it...
 
Local time
Yesterday, 19:19
Joined
Mar 4, 2008
Messages
3,856
What I can see is that there is no space between your files/paths and the options (/s /Y). I'm not sure if that will cause a problem or not.

A tricky little helper is to type in the command at the dos prompt followed by /? like this:

C:/> xcopy /?

will give you a list of the syntax and options for xcopy.
 

ajetrumpet

Banned
Local time
Yesterday, 19:19
Joined
Jun 22, 2007
Messages
5,638
i got it figured out george. thank you. here's the block:
Code:
echo off
Echo "Please insert a USB device for the weekly backup.  To cancel the backup, press Ctrl+C"
pause
xcopy c:\users\adam\"Adam's Files"/s f:\"Adam's Files"/y
thanks for pointer george. :)
 

Heywood43

Registered User.
Local time
Yesterday, 19:19
Joined
May 1, 2007
Messages
15
I would never discourage anyone from writing a script to do what they need but there are a couple of handy tools that come to mind I think you could make use of:

Microsoft Sync Toy 2 Beta

SyncBack Freeware

Both actually sync so you don't waste time over-writing unchanged files.

I know SyncBack also has the ability to FTP, send email logs etc. Maybe more than you might need but I have found it a valuable program. It has saved my bacon on more than one occasion!
 

Users who are viewing this thread

Top Bottom