Click here for important information about

List directories created today with DIR

September 26, 2011 at 08:18:17
Specs: Windows Server 2008 R2
I need to create a batch file that will give me an output if the work folder in my tomcat service was created today or if it wasn't. I have the script mostly written however the main issue I am having is that in server 2008 r2 I cant use %date% to filter which folders appear. the date format is coming back as "Mon 9/26/2011". I need the date to not include the "Mon". Basically i need the dir command to only kick back folder created or modified on today's date.

Any suggestions will be greatly appreciated.


See More: List directories created today with DIR

September 26, 2011 at 08:48:43
It sounds like your server is set up with a non-standard short date format. Normally you would expect the format to be "dd/mm/yyyy" but yours seems to be "ddd dd/mm/yyyy". Do you have Administrator access to change this (and if so would it create any other problems)?

Alternatively, include the line:

set date2=%date:4,10%

in your batch file and %date2% will contain the date in the format you require.

Report •

September 26, 2011 at 10:03:23
I do have admin access however the short date format is already listed as dd/mm/yyyy

Report •

September 26, 2011 at 10:33:53
Try Plan B then.

Report •

Related Solutions

September 26, 2011 at 11:12:36
Windows Server 2008 R2
Alternatively, use FORFILES.

How To Ask Questions The Smart Way

Report •

September 26, 2011 at 11:32:11
Yep, that's a better solution. I didn't know about FORFILES; you learn something new every day.

Report •

Ask Question