Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directory last modified date

Tags:

linux

unix

ftp

Am wondering when the directory last modified date is changed. I modified a file inside a particular directory (via FTP), but the directory's LMD did not change. How is it suppose to function?

like image 502
Alec Smart Avatar asked Sep 01 '10 17:09

Alec Smart


People also ask

How do I find the last modified date?

Windows file properties You can also see the modified date by viewing the file properties. Right-click the file and select Properties. In the Properties window, the Created date, Modified date, and Accessed date is displayed, similar to the example below.

How do I print the last modified time of a directory?

Using the stat command, we can also control the output by the -c FORMAT option. There are two formats to display the mtime: %y – displays time of last data modification in a human-readable format. %Y – displays time of last data modification in number of seconds since Epoch.

How can I tell when a directory was last modified Linux?

date command with -r option followed by the name of file will display the last modified date and time of the file. which is the last modified date and time of the given file. date command can also be used to determine the last modified date of a directory.

When was a file last modified?

The File. lastModified read-only property provides the last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date.


2 Answers

The mtime (modification time) on the directory itself changes when a file or a subdirectory is added, removed or renamed.

Modifying the contents of a file within the directory does not change the directory itself, nor does updating the modified times of a file or a subdirectory. Additionally, adding, removing or renaming files/directories in subdirectories does not propagate up to the directory. If you change the permissions on the directory, the ctime changes but the mtime does not.

like image 95
Jonathan Leffler Avatar answered Oct 23 '22 19:10

Jonathan Leffler


A directory is like a file that contains a list of the filenames in it (indeed, you may have accidentally opened a directory in an editor, where you can see it is a mostly-readable list of its contents) -- so it is modified when a file in that directory is added, removed, or renamed.

like image 24
Ether Avatar answered Oct 23 '22 20:10

Ether