Operating System - HP-UX
1825766 Members
2021 Online
109687 Solutions
New Discussion

listing date and time stamp always

 
SOLVED
Go to solution
eric stewart
Frequent Advisor

listing date and time stamp always

Is there a UNIX command or option to ls that will display the time stamp of files even when they are over a year old?
Good help is easy to find within forums
6 REPLIES 6
Patrick Wallek
Honored Contributor

Re: listing date and time stamp always

I don't think so. According the ls man page, the -l gives the date and time modified, but if the file is more than 6 months old the year is substituted for the time. I didn't see any option that would do anything much different.
James R. Ferguson
Acclaimed Contributor
Solution

Re: listing date and time stamp always

Eric:

There's no option of 'ls' to expose the full timestamp. You can expose the modification time, however, by creating a shell archive package (see man 'shar') with 'shar -m' for a file(s) in question and then 'grep' the archive for "touch -m". For example:

# shar -m old_file > /tmp/old_file.shar
# grep /tmp/old_file.shar 'touch -m'

...JRF...
Patrick Wallek
Honored Contributor

Re: listing date and time stamp always

Something I didn't mention earlier is that there is a '-c' option to ls which will list the last modification time of the inode. I don't think this is what you want though.
eric stewart
Frequent Advisor

Re: listing date and time stamp always

Thanks,
Here is the ouptut from the script I wrote based on the shar command.

SEP 12 1900 14:49 vax_to_unix/s_sumprddy.sas
SEP 12 1900 14:49 vax_to_unix/s_sumreldy.sas
SEP 12 1900 14:49 vax_to_unix/spidlist.sas
SEP 12 1900 14:49 vax_to_unix/sprdlist.sas

Now all I have to do is figure out how to assign points.
I think I have attached the script if any one wants it.
Good help is easy to find within forums
eric stewart
Frequent Advisor

Re: listing date and time stamp always

Correction to last attachment.
Good help is easy to find within forums
James R. Ferguson
Acclaimed Contributor

Re: listing date and time stamp always

Eric:

I would be remiss if I didn't point out that there is a "super ls" available from the porting archive. It's man page notes that, "sls is a program designed to overcome the limitations of the standard UNIX ls(1) program, providing a more consistent interface to file inode information. It is particularly designed for use by shell scripts...". I think this is exactly what you want.

http://hpux.cs.utah.edu/hppd/hpux/Shells/sls-1.0/man.html

...JRF...