It may be straightforward to find the last modified file in a given folder, but what if I wish to find the last modified file from among a group of folders, or from all the sub directories in a folder.
Here is my solution which makes use of the following two things:
* Command prompt (to get there in Windows, press Window key + R and type cmd)
* Any spreadsheet program like MS Excel, OpenOffice Calc etc.
Step 1:
At the command prompt, use the DIR command to generate the list of files that you wish to search among. It is important that the command returns a list of files with the date of modification column included.
Use the > operator to write the output to a file.
Example: DIR C:\myfolder\*.c /s /t:w > dir.txt
The above command, lists all the C files in the C:\myfolder directory and its subdirectories and creates a file dir.txt in the current working directory and writes the output into it. The /t:w switch makes sure that the date and time stamp is that of the last written date. Use /t:a, /t:c instead for last access, creation dates respectively.
Step 2:
Copy and paste from the above file into the spreadsheet program. A dialog box should pop-up asking to split into columns. Use fixed width delimiter and separate out the date and time stamps into separate columns.
Step 3:
Sort with the rule: date stamps first and then time.
Reference:
* DIR command reference, http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx?mfr=true
Comments
Post a Comment