Need to write a bat file to copy files

Posted on 2006-06-22
Last Modified: 2010-04-17
We have 20 guys that travel in vans all day.  On their laptops intheir vans, we monthly copy 3 gb worth of data to their local laptop.  The data and path on the laptop looks like this:

c:\Folder A
c:\Folder B

Inhouse, during the month, we may modify file2 in Folder A and add a file to Folder B.  At the end of the month, the folder / file network drive structure will look like:

H:\Folder A
----file1 (file has been modified)
H:\Folder B
----file4 (new file)

We would like to equip each van with a wireless 802.11g card and setup our parking garage as a hotspot.  This way, each day when they pulled into our garage, they would connect to our LAN.  They could then somehow run this bat file to get the most recent data from out server.  Since this folder structure will eventually be close to 5 GB, we do not want to copy everything.  Just added or modified items.  Is there a simple bat file that I could put in place to accomplish this?

Thanks in advance..
Question by:chadd25
LVL 13

Accepted Solution

rhickmott earned 125 total points
ID: 16960311
We have a similar setup on our server for backup purposes however it is written in PHP.

Im not sure what programming languages you know but a lot of them as long as you can create command line programs or execute from the command line can be run just as easily as batch files. You then have a lot better control over automation.

Its been years since ive looked at Batch processing but its changed a lot in WIN NT X but you will need to look at what criteria to see if a file has been changed.

The most simple would be to look at when it was last modified and if its newer then copy it over. You can use Windows Scheduled Tasks to execute a program or command at a certain time if you leave them on constantly or as I mentioned if you use a programming language you can write a client which will look for a connection to a master every 15 minutes and start once it detects it.
LVL 16

Assisted Solution

alain34 earned 125 total points
ID: 16960435
I think you are better off to try to install a folder synchronisation folder on each laptop.
This way, we the van are in the garage, they connect to the network and the folder on your server get synchronised with the folder on each laptop.
This way, you don't need to code anything

allwaysync can do thsi kind of things.
You can also look here
LVL 10

Assisted Solution

fostejo earned 125 total points
ID: 16963397

I'd suggest something like RoboCopy, one of the Microsoft Resource Kit tools, available at

RoboCopy could be called from an extremely simple VBScript or batch file - it's a very, very good utility and can intelligently synchronize - rather than blindly re-copying files - It's very fast, has built-in logging, bandwidth throttling etc. etc. etc.


Assisted Solution

yotamsher earned 125 total points
ID: 16987126
I think windows xcopy will do the job:
something like:
xcopy h:\ c:\ /e /d /h /y

these flags do the following:
/d makes coping newer files only
/y avoids prompting
/e is in charge of directory structure
/h in case you want hidden and system files

I hope this helps you

Expert Comment

ID: 17067467
one last comment, just got into something called SyncToy

It is part of Microsoft Power toys, and supposed to synchronize folders, like you wish


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question