Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • Thanks for zsh tips. Could you provide a link to more details about this in zsh docs ?
    – freezed
    Commented Apr 18, 2020 at 9:31
  • 1
    Thanks @Stephane Chazelas
    – freezed
    Commented Apr 20, 2020 at 7:41
  • 1
    I like *(.om[1]), but I usually want to find the newest file in a set of folders, ie. /path/to/folders*/*(.om[1]), which unfortunately only returns the newest file in all matched folders. See unix.stackexchange.com/questions/552103/… on how to accomplish it over multiple folders. Commented Sep 7, 2020 at 20:43
  • 2
    @SergioAraujo, c like find's -ctime is for the inode change time which has nothing to do with the creation time. The mtime can be seen as the creation time of the file's contents (as those are never created in one go). Some systems and filesystems record a birth*/*creation time which is the time a file's inode spawns (possibly again) into existence, but there's no portable API to retrieve that, and zsh has no corresponding sorting qualifier yet. But that particular time is not particularly useful. See When was file created Commented Nov 7, 2020 at 6:32
  • 1
    Excellent work on the recognition that not all filenames are nice. This is the robust version I was looking for (since I couldn't figure out how to use -print0 and printf. Your tip made things quite a bit more elegant than the also-robust BashFAQ/099 (which might get merged with BashFAQ/003). Commented Sep 16, 2022 at 23:09