Link to home
Start Free TrialLog in
Avatar of Nandha Kumar B
Nandha Kumar BFlag for India

asked on

use dir command

how to use dir command to search for files that ran last one hour ?

see the below command that search for last modified xml file in folder with the date
dir /b /a-d /o-d "%BaseDir%\*.xml" 2^>NUL

i need search for one hour file so need the command to search for time
Avatar of John
John
Flag of Canada image

The /T (Time) parameter does not sort or restrict time. You can do a DIR to a file and sort with Excel.

OR:

You can use Powershell to do this:

 https://social.technet.microsoft.com/Forums/ie/en-US/a7630d96-eaac-4879-9ca2-d34e70b3bb73/powershell-script-to-check-if-files-are-created-within-last-hour?forum=ITCG
Avatar of ste5an
First of all: Please define "ran last".. and what file system. And some context.

Assuming that it's NTFS: You have only the LastAccessed timestamp, but this don't tell you who accessed it. So a AV check may changes this.
Avatar of Nandha Kumar B

ASKER

Hi john,

i want to check word "error" in xml files under a path log(C:\logs\)  

under that log there are many xml and many files will be created every hour and then.

i need to check for error in particular time in the files created for last one hour.
I suggest you try getting the list of file with the Powershell command. DIR does not do this.
Thank you john for your help.

could you help me with powershell?
ASKER CERTIFIED SOLUTION
Avatar of John
John
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Nandha Kumar B - Thank you and good luck with determining recent files.