Link to home
Create AccountLog in
Avatar of charvett
charvettFlag for United States of America

asked on

How to list folders that don't contain recently created files


I'm trying to do some housekeeping on a number of folders. I'd like to have a batch file that will list folders that have no files created in the last X number of days.

For example, I'd like to list all the folders that haven't had any new files added to it in the last 30 days. That way I can identify folders that are not active.

A simple command line or batch file would be ideal. It's on a Windows 2005 Server.
Avatar of Anglian Learning Technical Services
Anglian Learning Technical Services

I tend to use VBScript to do file system operations of this sort.  Batch is fine for basic stuff, but VBS offers a much richer library of functions.  Date comparisons is a good example.
Avatar of Bill Prew
Are all the folders children of a common parent?  So you want to search all the subfolders of a single parent folder?

And what if there are nested folders, like:


and in dir2, file2-1 and file2-2 have not been changed in 30 days, but let's say file3-1 has been changed in less than 30 days.  Would dir2 get deleted or not?

Also, can you post up the output of two things, from a command line.


and then just a DIR on a couple of files.

I want to see the format of the date that your system is using.

Avatar of charvett



Thanks for the follow up. There are no nested folders, only a list of one deep folders with files in each.

The date format is: Thu 05/19/2011

Avatar of hari_b85
Flag of India image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account