Last files modified windows

Find files by date modified in Windows

Using the date modified feature in Windows File Explorer allows you to find any files that were modified on a specific date or over a range of dates. Using this tip can be helpful for anyone who had lost a file, but knows when they last modified it.

How to find the date of modified files

  1. Press the Windows key + E on the keyboard to open File Explorer.
  2. On the left side scrolling menu, select the drive or folder where you’d like to view dates ( 1 ).

  1. Then, on the right side of the screen, type datemodified: (make sure to include the colon) into the search box ( 2 ).
  2. Once done, a menu similar to the one shown below should appear.

  1. From here, you have a few options:
  • View a single day — Navigate to the day you’re interested in and click it.
  • View a range within a month — Click and hold down your left mouse button on the starting date, and then drag your mouse cursor to the ending date.
  • View a range over a long period — If you need information that spans more than one month or year, you utilize a specific format in the search box. As an example, if you’d like to view the modified dates between October 13, 2018, and November 10, 2018, you would type: datemodified:10/31/2018 .. 11/10/2018 exactly as it is written there, and then press Enter .
Читайте также:  Windows 10 outlook задачи

Check last modified date of file in C#

I’m looking to find out a way of seeing when a file was last modified in C#. I have full access to the file.

4 Answers 4

You simply want the File.GetLastWriteTime static method.

Note however that in the rare case the last-modified time is not updated by the system when writing to the file (this can happen intentionally as an optimisation for high-frequency writing, e.g. logging, or as a bug), then this approach will fail, and you will instead need to subscribe to file write notifications from the system, constantly listening.

Be aware that the function File.GetLastWriteTime does not always work as expected, the values are sometimes not instantaneously updated by the OS. You may get an old Timestamp, even if the file has been modified right before.

The behaviour may vary between OS versions. For example, this unit test worked well every time on my developer machine, but it always fails on our build server.

a) live with the occasional omissions.

b) Build up an active component realising the observer pattern (eg. a tcp server client structure), communicating the changes directly instead of writing / reading files. Fast and flexible, but another dependency and a possible point of failure (and some work, of course).

How to get file’s last modified date on Windows command line?

I have been using the following command to get the file date. However, the fileDate variable has been returning blank value ever since we moved to a different server (Windows Server 2003).

Is there any other more reliable way to get the file date?

Читайте также:  Ошибка загрузки медиа system windows media invalidwmpversionexception

9 Answers 9

Change % to %% for use in batch file, for %

ta syntax enter call /?

0,10% – Ricky Supit Jan 25 ’10 at 19:33

ta or %a is – FistOfFury Jan 6 ’15 at 22:01

t is only precise to the minute. Powershell also gives seconds via the two part command: $myFileInfo = Get-Item C:\myPath\myFile.txt $myFileInfo.LastWriteTime – BeatriceThalo Dec 9 ’19 at 20:43

Useful reference to get file properties using a batch file, included is the last modified time:

To get the last modification date/time of a file in a locale-independent manner you could use the wmic command with the DataFile alias:

Regard that the full path to the file must be provided and that all path separators (backslashes \ ) must be doubled herein.

This returns a standardised date/time value like this (meaning 12 th of August 2019, 13:00:00, UTC + 120′):

To capture the date/time value use for /F , then you can assign it to a variable using set :

The second for /F loop avoids artefacts (like orphaned carriage-return characters) from conversion of the Unicode output of wmic to ASCII/ANSI text by the first for /F loop (see also this answer).

You can then use sub-string expansion to extract the pure date or the time from this:

To get the creation date/time or the last access date/time, just replace the property LastModified by CreationDate or LastAccessed , respectively. To get information about a directory rather than a file, use the alias FSDir instead of DataFile .

For specifying file (or directory) paths/names containing both , and ) , which are usually not accepted by wmic , take a look at this question.

Читайте также:  Win tab windows 10 отключить

Check out also this post as well as this one about how to get file and directory date/time stamps.

Оцените статью