4

Windows 10, Emacs 25.1, Dired+

I use file manager Total Commander. And I set them to show different color (blue) for recent(e.g 1 hour) created/edited files/folder. It's very comfortably.

Here example:

TC_recent_folders

Is it possible in Emacs in Dired+ mode?

2

1 Answer 1

0

This doesn't answer your question directly, but I think it might help.

  1. File creation date is not recorded for some file systems. But you can generally get the last-modified date.

  2. Just use s to sort the listing by last-modification time. The recently modified files are at the top of each directory listing in the buffer.

  3. Highlighting the recently modified files would certainly be possible (with "recent" being defined relative to some time/date parameter/variable). But why bother? (See #2.)

  4. More useful (I think) than highlighting a set of files would be marking them - in this case, marking the files modified more recently than some time/date. Or marking the files modified between two times/dates.

    Marking lets you act in various ways on the marked files and directories. And marks are visible, just like highlighting. (I might add such a marking feature to Dired+ when I get a moment; dunno.)

  5. Actually, you already have #4, in a fashion. Command dired-mark-sexp, which with Dired+ is bound to both M-( and * ( and is menu item Mark If... in menu Marks > Mark, lets you mark files and dirs according to any Lisp expression.

    And it predefines some variables you can use in the expression. One of those variables is time, which is the time string used in the Dired listing. So this would mark all files whose last-modification times match the string "10-19":

    M-x dired-mark-sexp RET (string-match-p "10-19" time)

    Alternatively, you could convert such string times to Emacs-Lisp time lists or to numbers and calculate whether the time falls in some time range you are interested.

    Or if you don't want to use the displayed time string you can use file-attributes with predefined variable name, to get the last-modified time directly.

  6. Library find-dired+.el, which enhances standard library find-dired.el, provides command find-time-dired. It finds files in a directory that were last modified between two times/dates. If you use Dired+ then you'll find this command as menu item Find Files By Time in menu Dir > Run ‘find’ Command.

    • You are prompted for the directory (default: current) and for the two times/dates - the default for the later one is the current time.

    • The output is shown in a Dired buffer.

    • You can also optionally specify directory-hierarchy depth limits, to search for files. By default, check all files under the current directory.

    • You can also optionally specify a list of subdirs to exclude from checking.

4
  • your first point is not exactly correct. On System V, BSD (including MacOS X) and Linux three dates are recorded, creation time, modification time, and last access time. You can check this via ls --help and trying it out. Most file managers can display them, one just needs to activate the according fields in the list view.
    – user17303
    Commented Oct 22, 2017 at 21:08
  • …and on Solaris and Ultrix. I just checked. let me correct your statement 1: ctime is not recorded some systems. On Unix, we always have ctime,mtime, and atime. That 'ls' and most file managers display only mtime by default is another thing.
    – user17303
    Commented Oct 22, 2017 at 21:42
  • @kuli: Thanks. I've edited point 1 to be less black & white, not refer to any specific system, and speak of file system. This question discusses the question of creation data a bit.
    – Drew
    Commented Oct 23, 2017 at 1:02
  • 1
    You're welcome. It is a long-standing discussion whether ctime is creation time or change time, but in any Unix manual it is creation time. And it is the oldest of the three times you can list via ls -l, ls -lc and ls -lu, So I'll stick with creation as most likely.
    – user17303
    Commented Oct 23, 2017 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.