Bat file to move files/sync folders

We are trying to write a bat file that will keep two directories/folders up to date, but we only want the newest files moved i.e. so one directory has 110 files the other 100, we only want to move the 10 missing files.    At this time the bat file copies all files over, which is taking much time as the directory has many files.    Can anyone help?
stevendeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Take a look at robocopy.

If you really want to move the files, then I don't see a problem in doing an "overwrite" here. Moving files is a "cheap" operation in comparison to copying, cause only the directory entries in NTFS are adjusted.
0
stevendeveloperAuthor Commented:
At present there are 85000 files will it quickly move the files?
0
Bill PrewCommented:
Can you clarify a bit more about what you need to accomplish.  In your question, you mention "newest", but then you also mentioned "missing" as the files you want to copy.  More specifics would be helpful.  Think about all cases:

files that don't exist in source but do in destination
files that don't exist in destination but do in source
files newer in source
files older in source
files that are exactly the same
do you just want to compare based on last update time, or actual content
etc...


»bp
0
stevendeveloperAuthor Commented:
Ok sorry I would like to keep the directories in sync, but do not want to move all files each night, only ones that don't exist in the destination..
0
Bill PrewCommented:
Sounds like ROBOCOPY with the /MIR option may be what you are looking for.


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.