in reply to stat on find output

Your problem is with new lines. Specifically, your input from find ends each line with a new line, but of course there is no file "growthmonitor.sas\n" on your system, so the stat fails and all elements of @d are the start of the epoch. You can fix your code by chomping your input before feeding it to stat; of course, you also need to add a newline to your output. The following will do what you expect:

find /sasdata/it/development/sasmonitoring/code -type f |perl -e 'while (<>) {chomp;$l=$_;@d=localtime((stat($l))[8]);printf "%4d%02d%02d %s\n",$d[5]+1900,$d[4]+1,$d[3],$l}'

Replies are listed 'Best First'.
Re^2: stat on find output
by hitesh_ofdoon (Initiate) on Oct 19, 2009 at 21:49 UTC
    Yes, it was chomp. It's working now. Thank you guys for responding.