1

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
  • 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, 2015 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, 2015 at 15:53

2 Answers 2

1

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

2
  • That works well (though of course its not via the command line, can it be automated?). Good recommendation.
    – AlainD
    Aug 6, 2015 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. Aug 6, 2015 at 16:14
2

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .