在一个目录和所有子目录中找到最近修改的文件

find path_to_dir -type f 打印目录树中的所有文件
chomp(@files = <>); 将所有行读入数组
stat($a)是一个有关文件的有趣信息的数组。索引7是大小,8是访问时间,9是修改时间等。(有关man perlfunc详细信息和搜索,请参阅stat EXPR。)
sort { (stat($a))[9] <=> (stat($b))[9] } @files 按修改时间对文件进行排序
print scalar localtime((stat($f))[9]), "\t", $f, "\n" - 打印好格式化的修改时间,然后是选项卡和文件名
.

0

linux命令:find /path/to/dir -type f | perl -ne 'chomp(@files = <>); my $p = 9; foreach my $f (sort { (stat($a))[$p] <=> (stat($b))[$p] } @files) { print scalar localtime((stat($f))[$p]), "\t", $f, "\n" }' | tail tail | }' "\n" $f, "\t", localtime((stat($f))[$p]), scalar print { @files) } (stat($b))[$p] <=> (stat($a))[$p] { (sort $f my foreach 9; = $p my <>); = 'chomp(@files -ne perl | f -type /path/to/dir find find /path/to/dir -type f | perl -ne 'chomp(@files = <>); my $p = 9; foreach my $f (sort { (stat($a))[$p] <=> (stat($b))[$p] } @files) { print scalar localtime((stat($f))[$p]), "\t", $f, "\n" }' | tailrootopen.com
linux命令:find /path/to/dir -type f | perl -ne 'chomp(@files = <>); my $p = 9; foreach my $f (sort { (stat($a))[$p] <=> (stat($b))[$p] } @files) { print scalar localtime((stat($f))[$p]), "\t", $f, "\n" }' | tail tail | }' "\n" $f, "\t", localtime((stat($f))[$p]), scalar print { @files) } (stat($b))[$p] <=> (stat($a))[$p] { (sort $f my foreach 9; = $p my <>); = 'chomp(@files -ne perl | f -type /path/to/dir find find /path/to/dir -type f | perl -ne 'chomp(@files = <>); my $p = 9; foreach my $f (sort { (stat($a))[$p] <=> (stat($b))[$p] } @files) { print scalar localtime((stat($f))[$p]), "\t", $f, "\n" }' | tailrootopen.com
gdji 2018-12-08 16:51:43
输出

评论

相关推荐
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

热门文章