From the command prompt, the script:

C:\>dir *.* /s > a.txt

will list all files in the TXT file (a.txt) which can then be opened in Notepad or another text editor. You can then search through the list for files modified within a timeframe (eg. today). For example, this question is written on 06 August 2015, so I can search for "06/08/2015". You can even improve that by looking for "06/08/2015 10" for files created after 10:00 today.

This works fine, but the file generated can very large (and takes a while to generate). Is it possible to do better (preferably, though not restricted to, from the command line).

  • 2
    Which version of Windows? Adding /od will sort by date within each directory so at least all the files of interest will need grouped together. Or install cygwin and use find ;) – cxw Aug 6 '15 at 9:44
  • Windows XP and Windows 8.1. Haven't tried the /od switch yet, will try later. I've heard of cygwin...but not used it before. – AlainD Aug 6 '15 at 15:53

I recommend File Locator Lite. It has a date tab. It's lightweight and easy to use.

  • That works well (though of course its not via the command line, can it be automated?). Good recommendation. – AlainD Aug 6 '15 at 15:52
  • @AlainD - I'm sorry, I don't know, but there is a paid version, so my guess would be yes, in one version or the other, and I bet they'll respond to a query. – aparente001 Aug 6 '15 at 16:14

How about some powershell?

 get-childitem -recurse | where-object { $_.lastwritetime -gt (get-date).addHours(-100)}

I think this will work fine for you.

Example output:

 12:20 x D:\Users\x > get-childitem -recurse |where-object {$_.lastwritetime -gt (get-date).addHours(-100)}

    Directory: D:\Users\x

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        2015-08-06     10:43            Desktop

    Directory: D:\Users\x\Desktop

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        2015-08-05     16:38     636963 20119998885_921a43c7b4_k.jpg
-a---        2015-08-03     15:45     206011 cpu.csv

    Directory: D:\Users\x\Important\Passwd

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        2015-08-05     10:49         62 main.plk

Get-childitem is like old dir but the output is more like objects not like text streams. Each item has properties - for example lastwritetime which is exactly like modify time. You can do arithmetics on those parameters with functions like addDays or addHours to get the desired filter based on date.

Of course you can use -eq instead of -gt and provide exact date to match. I think you can even use -match operator and specify the mask with wildcards to match the desired date. Try it. Its better then pure cmd.

  • Looks good, will try tonight... – AlainD Aug 6 '15 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.