Hi,
I want to know the last modified time (TimeStamp) of a file so that can compare it with some TimeStamp and delete it.
Help is appreciated.
Thanks
Printable View
Hi,
I want to know the last modified time (TimeStamp) of a file so that can compare it with some TimeStamp and delete it.
Help is appreciated.
Thanks
You can use stat... I suggest a "man stat"
Though this is a Linux forum but I am working on AIX and it don't support stat command. Any other alternate?
shows the last time the file was modified.Code:ll <filename>
"ll" isn't an preconfigured alias in all distros, if it doesn't work try "ls -l file"
It used to work just fine on AIX.... the platform he's on.
And you're right, it isn't available everywhere.
ll is just an alias, best to use the real command. It's always annoyed me that there's not easy way to get the times of files (GNU's stat() notwithstanding) and I've usually resorted to writing my own for those systems that don't provide it.
will get you the raw information, but be aware that $7 may be the time or the year, depending on the whether the file was modified within the last year.Code:MTIME=$(/bin/ls -lo file | /usr/bin/awk '{print $5,$6,$7}')
Thanks to all who replied to my query.
Actually I want to check the files in a directory for certain TimeStamp for modification and want to send the names of those files in the mail.
I am a java developer and not an expert in writing scripts. So help is appreciated.
Regards.