文件的任何随机列表寻找通用的方法如何排序的修改时间的文件的随机列表,所以像:排序方式修改日期
./make_list_of_files | some_sorter_by_mtime
我当期的解决方案是(这里的make_list_of_files
是find
命令):
find/-type f -print |\
perl -nle 'push @in,$_;END {@out = sort{ (stat($a))[9] <=> (stat($b))[9] } @in; $,="\n";print @out}'
存在一些简单的解决方案(例如,没有perl的)?
接受!这很好,很短... thanx。 – kobame
这比我以前的解决方案更快。我看到emix的解决方案后,编辑了我的答案,并偷走了xargs;) – jm666