• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Move Files based on date Batch File


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.

1 Solution
aflat362Author Commented:

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.
There is no date comparator function in DOS' command.com or cmd.exe. I recommend vbscript or perl.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now