Move Files based on date Batch File

Posted on 2003-03-14
Medium Priority
Last Modified: 2010-04-13

Is there a way to tell what the DateLastModified date for a file is in Win 2K command Line?

My goal is to have a batch file that does the following:

Move All Files From directory X that have a DateLastModified Date which is older than 7 days to Directory Y.

The directory paths and the file retention date can be hard-coded.  Or if you have a better idea that would be cool too but I figure hard coding would be easiest.

I can do this in VBS, VB, C++ already but I want to learn more about Batch Scripting and this seems like it would be a good exercise.

Question by:aflat362
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

Author Comment

ID: 8137676

Bonus 20 points if you can tell me how to

Move all files from directory X that have a last modified date of YYYY-MM-DD to directory Y

In a Batch file.

Accepted Solution

danich earned 150 total points
ID: 8140843
There is no date comparator function in DOS' command.com or cmd.exe. I recommend vbscript or perl.

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

770 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