Batch file to copy paste

I need a batch file which will copy files which the modified date is not the current date from a folder A and paste it in folder B.


to delete files from folder B which is older than five days (from top)

And i need to schedule it in windows scheduler to run this at 15:00 . If the today's file not arrived at 15:00 it should run at 16:00 and again its not arrived 17:00 and so on ...till 23:00...

Please help me !
Who is Participating?

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

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.

"xcopy <source> <destination> /D /Y" will work to copy/overwrite files that are newer than what already exists in the destination.
As for deletion of older files, you may need to run something from vbs.
jaisonshereenAuthor Commented:
how to delete the file according to "modified date"?
This VBS looks to be pretty much exactly what you are after...
jaisonshereenAuthor Commented:
could you tell me how to execute this?

i have copy pasted the entire script as filename.vbs

is it a mater of double clicking?
Double-click will work. You could call it from the batch file with "wscript filename.vbs".
You could then schedule the batch file to run automatically.

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
Microsoft DOS

From novice to tech pro — start learning today.