List files and timestamp of creation on AIX system (Perl)

487 views Asked by At

I want to perform a command like ls -l --time-style="+%s" on an AIX system.
I only need the timestamp of the file and the filename.

With this answer, I made:

find . -type f -exec perl -le 'print((stat shift)[9])' {} \;

But I can't find a way to print the filename with Perl (I don't know the language and have troubles with the one-liner syntax).
I'm experimenting with something like this:

perl -le 'print((stat shift)[9] . " ???")' foo.txt

Can anyone help me out?

1

There are 1 answers

3
mpapec On BEST ANSWER

What you're looking for is @ARGV array, which you can use to loop over, and check $_ for current file name,

perl -le 'print((stat $_)[9] . " $_") for @ARGV' foo.txt