≡ Menu

Find The Last Modified Files On Your System

Have you ever click on a save button and don’t know where your files are? Do you want to know what files have been changed by the last running program? Here you will find an easy way to know what the last modified files of your system are.

Powershell is the new scripting language for Windows systems. To use this new feature in Windows 7 you don’t need to install anything. We are going to create a Script using Powershell that is going to show those modified files.

Windows 7 is very restrictive with the use of Powershell, so we are going to need to insert the script in a bat file to execute it.

The script

Here is the code:

@echo off

Powershell -noexit "Get-PSdrive  | where { $_.Used -gt 0 } | foreach { Get-ChildItem $_.Root -recurse -ErrorAction SilentlyContinue | Where {!$_.PsIsContainer} | Where {$_.DirectoryName -notlike 'c:\windows*' } | Select Name,DirectoryName, LastWriteTime, Mode | Sort LastWriteTime -descending | select -first 20}  | Out-GridView"

The script only displays 20 results, if you want more or less just change the number after select -first.

Open a new notepad. For this use WinKey + R, type notepad and press Enter.Once notepad is open copy the script and you will get something like this:

Save it using the file menu, but don’t forget to use the quotation marks, so notepad will create a bat file.

Click on the save button and a new file will appear.

The test

Open a Wordpad or whatever program you want and write something:

Save it to have a new file. Execute the script and see the result. Be patient the script has to process every file on your system.

The script only shows the last 30 modified files. In order to obtain better information the hidden files are not displayed. The script doesn’t show if a file has changed in the Windows directory. You have to understand that Windows 7 is doing a lot of work without your notice and this solution try to focus in what the user or the programs has done.

I hope you have enjoyed the reading and find the script useful. So why not letting me know new ideas for a script?

About the author: I am an Engineer of Telecommunications that love computers. My first computer was a Commodore 16kb, about 25 years ago and since then I am always fighting computers problems. Please visit my entries and ask me about whatever problem you have, I will be pleased to help you. My email is discoveryourpc [at] gmail [dot] com. You can follow me on twitter @agenlu or read my blog www.discoveryourpc.net

2 comments… add one
  • Ashok Kumar October 29, 2010, 7:16 PM

    will this script work in xp???

    • Angel October 29, 2010, 9:06 PM

      You can install Powershell in Windows Xp is a free download from Microsoft.

Leave a Comment