Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm hoping this can be handled with some PowerShell tricks.

I have a directory on my work machine (Windows XP) containing tons of PDFs, some of which I've annotated and resaved. I'd like to be able to identify the ones I've annotated using the following simple heuristic: find files where the modified date is more recent than the created date. I don't just want to sort by date modified, because many unannotated, but recently added, PDFs will clutter the list.

Also, sometimes immediately after saving I do some quick edit to the file which touches its modified date, but not in a meaningful way. So, if I were able to only ID the files where modified date is more than 1 day later than the created date, I'd be set. Any ideas for the command to use, and should I be doing this in powershell?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You'll want to do some formatting of your output, but try this:

Get-ChildItem F:\Temp\* -recurse -include *.pdf | ForEach-Object { If (($_.LastWritetime - $_.CreationTime).Days -gt 1) { Write-Host $_.Name } }

Replace "F:\Temp\" with your own path.

share|improve this answer
Is there a simple way to tweak to make it recursive? This is a Zotero library of PDFs, so each PDF is actually stored in its own subdirectory with hash-y names for the subdirectories. –  Daniel Kessler May 23 '13 at 19:14
Nevermind, figured it out, and submitted edit to your answer to make it recursive and to only include PDFs. Thanks! –  Daniel Kessler May 23 '13 at 19:19
Is there a simple way I can include some sort of delimter (e.g. tab, comma, null character) and dump it to a file so I can sort and parse? I'm decent in bash, but not so nimble in powershell. –  Daniel Kessler May 23 '13 at 19:23
I just updated the command it should output only the filename now of the files where the difference is at least a day. –  Jack May 23 '13 at 20:01

Try something like this:

ls C:\Path | ?{($_.LastWriteTime - $_.CreationTime).Days -gt 1} |
Select Name,CreationTime,LastWriteTime | Export-CSV .\Annotated.csv

This will provide a list of files where the last write time minus the creation time is greater than one day (anything modified after a day) and export it to a CSV in the working directory.

You can add the -recursive and -include *.pdf for recursion and PDF filtering respectively.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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