How do I get the name of the newest file via the Terminal?

前端 未结 6 868
渐次进展
渐次进展 2021-01-12 12:29

I\'m trying to create a macro for Keyboard Maestro for OS X doing the following:

  1. Get name of newest file in a directory on my disk based on date created;
6条回答
  •  抹茶落季
    2021-01-12 12:45

    Using output of ls is bad practice.

    find -type f -printf '%T+ %p\n' | sort -r | head -n 1

提交回复
热议问题