Solved

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

Posted on 2011-09-23
4
407 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Accepted Solution

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

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

742 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