extract last modified time of file in form of YYYYMMDD

Hi All,

I want to extract last modified, seen in ls -l command, of a file and then convert it into "YYYYMMDD" format.

Any help regarding would be helpful

Thanks in advance...

try this:

stat -c '%y' filename | cut -d ' ' -f1 | sed -e 's/-//g'

I couldn't find "stat" in solaris - what is the path? Btw, since I'm learning python :slight_smile:

File:

 Directory of C:\Tmp

05/28/2008  01:46 PM                 5 abcd
print "%04d%02d%02d\n" % time.localtime(os.stat("abcd")[-2])[0:3]

Should work in Windows & Unix/Linux provided you have python installed :slight_smile:

Hi

I dont find "stat" in IBM AIX