Avatar of charvett
charvett
Flag for United States of America asked on

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

Hello,

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.
Microsoft DOSMicrosoft Server OS

Avatar of undefined
Last Comment
hari_b85

8/22/2022 - Mon
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.
Bill Prew

Are all the folders children of a common parent?  So you want to search all the subfolders of a single parent folder?

~bp
Bill Prew

And what if there are nested folders, like:

dir1
   dir2
      file2-1
      file2-2
      dir3
        file3-1
        file3-2

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?

~bp
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Bill Prew

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

ECHO %DATE%

and then just a DIR on a couple of files.

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

~bp
charvett

ASKER
Hello,

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

Thanks!
ASKER CERTIFIED SOLUTION
hari_b85

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.