Link to home
Start Free TrialLog in
Avatar of holemania
holemania

asked on

Command Prompt - Batch file to move files base on create date

I have a folder that I've been archiving files.  This folder is getting large, so I need to archive anything that is more than 2 months old.  Is there a bat script that someone has that I can use to move files base on create date from Folder1 to Folder2?

Folder location is as followed:

Folder1:
\\nt-1\data\backup\Archive

Folder2:
\\nt-2\data\backup\ArchiveOldFiles

So I want a script that can look into the Archive folder and see files that has been created that's more than 2 months old.  Move those files to the folder ArchiveOldFiles.  Any examples or script someone can provide me?  This would be a bat file where I can schedule to run like once a month or something.
ASKER CERTIFIED SOLUTION
Avatar of Govvy
Govvy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of holemania
holemania

ASKER

Thanks guys.  I got it working from Govvy's advice.

robocopy \\nt-1\data\backup\archive \\nt-2\data\backup\ArchiveOldFile /move minage:60
Got it working with Govvy's suggestion.  Thanks for the example gerwinjansen.  I did similar to what you posted, but got it working before you post.  So to be fair, I give Govvy a little bit more points.