[英]Sorting files based on time in Linux
I want to get a list of pathnames of files, divided by one blank space, and the files are sorted based on creation time. 我想获取文件的路径名列表,除以一个空格,然后根据创建时间对文件进行排序。 I use
我用
find $dir -type f -printf '%T+\t%p\n' | sort -n
to sort them, but the problem is, how can to delete all the time before the pathnames? 对它们进行排序,但是问题是,如何才能始终删除路径名之前的所有内容?
If I use 如果我用
find $dir -printf '%p'
I can get a list of pathnames, but I don't know how to sort them. 我可以获得路径名列表,但不知道如何对它们进行排序。
你可以用切
find $dir -type f -printf '%T+\t%p\n' | sort -n | cut -f2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.