在 AIX 系统 (Perl) 上列出文件和创建时间戳
List files and timestamp of creation on AIX system (Perl)
我想在 AIX 系统上执行类似 ls -l --time-style="+%s"
的命令。
我只需要文件的时间戳和文件名。
使用 this answer,我做了:
find . -type f -exec perl -le 'print((stat shift)[9])' {} \;
但是我找不到用 Perl 打印文件名的方法(我不懂这种语言,而且对单行语法有问题)。
我正在尝试这样的事情:
perl -le 'print((stat shift)[9] . " ???")' foo.txt
谁能帮帮我?
你要找的是 @ARGV
数组,你可以用它来循环,并检查 $_
当前文件名,
perl -le 'print((stat $_)[9] . " $_") for @ARGV' foo.txt
我想在 AIX 系统上执行类似 ls -l --time-style="+%s"
的命令。
我只需要文件的时间戳和文件名。
使用 this answer,我做了:
find . -type f -exec perl -le 'print((stat shift)[9])' {} \;
但是我找不到用 Perl 打印文件名的方法(我不懂这种语言,而且对单行语法有问题)。
我正在尝试这样的事情:
perl -le 'print((stat shift)[9] . " ???")' foo.txt
谁能帮帮我?
你要找的是 @ARGV
数组,你可以用它来循环,并检查 $_
当前文件名,
perl -le 'print((stat $_)[9] . " $_") for @ARGV' foo.txt