Batch file syntax

R

Robert M Jones

Win XP Home
I have got a backup batch file working well on a schedule thanks to
advice in help_and_support a day or so ago from Mr.Helpful.
I now wish to modify the commands to create a bat file which will back
up a more complex folder structure, and include folders with sub folders
etc. The sub folder structure is already replicated on the destination site.

My post there hasn't had a response so am trying here.

I am trying the following - but not all the sub folder contents are
copying across.
@echo off
copy "C:\Documents and Settings\Robert user\Application
Data\MailWasherPro\*.*" f:\appdata\mailwasherpro\ /v /y
copy "C:\Documents and Settings\Robert user\Application
Data\Mozilla\*.*" f:\appdata\mozilla /v /y
copy "C:\Documents and Settings\Robert user\Application
Data\Thunderbird\*.*" f:\appdata\thunderbird /v /y
copy "C:\Documents and Settings\Robert user\Application
Data\Skype\*.*" f:\appdata\skype\ /v /y
How do I modigfy this to make sure that all subfolders and their
contents copy each time please?
Many thanks for the help so far.

--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420
 
P

Pegasus \(MVP\)

Try this:

@echo off
xcopy "C:\Documents and Settings\Robert user\Application Data\MailWasherPro"
f:\appdata\mailwasherpro\ /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Mozilla"
f:\appdata\mozilla /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Thunderbird"
f:\appdata\thunderbird /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Skype"
f:\appdata\skype\ /v /y /s
echo.
pause
 
R

Robert M Jones

Pegasus said:
Try this:

@echo off
xcopy "C:\Documents and Settings\Robert user\Application Data\MailWasherPro"
f:\appdata\mailwasherpro\ /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Mozilla"
f:\appdata\mozilla /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Thunderbird"
f:\appdata\thunderbird /v /y /s
xcopy "C:\Documents and Settings\Robert user\Application Data\Skype"
f:\appdata\skype\ /v /y /s
echo.
pause

Thank you very much - that works nicely - presumably the /s is for the
subfolders?
Also - if I want it to exist automatically do I replace the "pause" with
an "exit"? At the moment it finishes with
"press any key to continue" but I want it to run unattended with scheduler.

--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420
 
P

Pegasus \(MVP\)

Robert M Jones said:
Thank you very much - that works nicely - presumably the /s is for the
subfolders?
Also - if I want it to exist automatically do I replace the "pause" with
an "exit"? At the moment it finishes with
"press any key to continue" but I want it to run unattended with scheduler.

Start a Command Prompt and type xcopy /? to find out the meaing
of every switch I used.

Remove the "pause" command to make the batch file terminate
without user intervention. You should experiment with these
things yourself in order to build up your confidence!
 
R

Robert M Jones

Pegasus said:
Start a Command Prompt and type xcopy /? to find out the meaing
of every switch I used.

Remove the "pause" command to make the batch file terminate
without user intervention. You should experiment with these
things yourself in order to build up your confidence!
Thank you again -- that all works fine. I've checked the syntax list - I
had originally looked for the help/syntax on "copy" which wasn't clear
but the xcopy /? command gives a nice list thanks.
Yes - I'll experiment!
Thanks again.

--
Rev Robert M Jones, Wimborne Baptist Church, UK
http://www.wimborne-baptist.org.uk
Free trial of Mailwasher Pro - effective email spam filter - (commission
goes to our partners in Bulgaria)
http://fta.firetrust.com/index.cgi?id=420
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top