Find top N oldest files on AIX system not supporting printf in find command

With perl:

find /home/sk/ostechnix/ -type f -exec perl -le '
  use POSIX; foreach (@ARGV) { $d=(stat)[9]; print POSIX::strftime("%Y-%m-%d %H:%M:%S ", localtime $d), $_ }
' {} + | sort | head

1 Like