Skip to main content

How to find the last modified file ?

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:

Comments

Popular posts from this blog

Jump start into Character Recognition - Part 1

Motivation The dawn of computers and their integration into a huge network called the internet has accelerated the sharing of knowledge like never before. However, there exists a divide between the forms of expression familiar to us and the forms in which the information can be fed in at a computer terminal. For example, when writing about scientific material we make extensive use of diagrams to convey the ideas, but, feeding a graphic into the computer, requires special effort and doesn't come naturally. These and other aspects have always been a matter of concern for me, being someone fond of publishing on the web whatever I know :) Any how, the aim of this article and other in this series is not to demonstrate my solution to the above problem ... instead to attract young and curious minds to the problem so that they may contribute to it solution. Start The plan is to build, step by step, a very simple, character recognition program which would take a simple text file contai...