Solved

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

Posted on 2011-09-23
4
395 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:holemania
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
Govvy earned 300 total points
ID: 36589733
Use robocopy command with /MINAGE flag
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 200 total points
ID: 36589851
robocopy \\nt-1\data\backup\Archive \\nt-2\data\backup\ArchiveOldFiles /minage:60 /move

Open in new window

0
 

Author Comment

by:holemania
ID: 36589973
Thanks guys.  I got it working from Govvy's advice.

robocopy \\nt-1\data\backup\archive \\nt-2\data\backup\ArchiveOldFile /move minage:60
0
 

Author Closing Comment

by:holemania
ID: 36589983
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.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now