如何在目录中(在Solaris中)递归地找到最新的修改文件?

时间:2018-08-21 15:06:36

标签: unix recursion find solaris sunos

已经有another question的答案,如下:

find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "

但是当我在Solaris上运行此错误消息

find: bad option -printf
find: [-H | -L] path-list predicate-list

这是我运行uname -a

时得到的信息
SunOS <SERVER NAME HERE> 5.10 Generic_150400-59 sun4u sparc SUNW,SPARC-Enterprise

有人知道Solaris等效吗?拜托了,谢谢!

请谢谢!

1 个答案:

答案 0 :(得分:0)

Solaris中的“查找”没有“ -printf”选项。

但是您可以执行以下操作。

find . -type f -exec /bin/ls -E {} \; | sort -k6,7 | tail -1

然后,您会看到类似的东西。

rw-r--r--   1 root     other          109 2018-09-13 00:37:39.295187000 +0900 ./newest.txt
相关问题