time and date stamp of a file

time and date stamp of a file

Post by Ken Clar » Fri, 28 Sep 2001 23:39:12



Is there a unix (solaris) command that will return JUST the time and date
stamp of a file.  I hate parsing things out of  'ls'.

Thanks, k

 
 
 

time and date stamp of a file

Post by Tony Curti » Fri, 28 Sep 2001 23:43:28


>> On Thu, 27 Sep 2001 10:39:12 -0400,

> Is there a unix (solaris) command that will return JUST
> the time and date stamp of a file.  I hate parsing
> things out of 'ls'.

Which timestamp do you want?

You need to stat(2) the file and look at the appropriate
st_[acm]time member.

perl would be the quickest scriptable solution to this
(why isn't there a stat(1) in Solaris?)

e.g. modification time of /etc/passwd:

    use File::stat;
    my $s = stat('/etc/passwd');
    print scalar localtime($s->mtime), "\n";

hth
t
--
Yes way!  Mmmmkay?

 
 
 

time and date stamp of a file

Post by Tony Walto » Fri, 28 Sep 2001 23:49:00



> Is there a unix (solaris) command that will return JUST the time and date
> stamp of a file.  I hate parsing things out of  'ls'.

No.

--
Tony

 
 
 

time and date stamp of a file

Post by CeeJa » Sat, 29 Sep 2001 10:27:35


Yes, you can:

touch -t 199906042020 filename #date stamp


Quote:> Is there a unix (solaris) command that will return JUST the time and date
> stamp of a file.  I hate parsing things out of  'ls'.

> Thanks, k

 
 
 

time and date stamp of a file

Post by Tony Walto » Sat, 29 Sep 2001 18:02:55





> > Is there a unix (solaris) command that will return JUST the time and date
> > stamp of a file.  I hate parsing things out of  'ls'.
> Yes, you can:

> touch -t 199906042020 filename #date stamp

Perhaps I'm dim, but I can't see how that anywhere near approaches what
the OP was asking for.

--
Tony

 
 
 

time and date stamp of a file

Post by Chris Thomps » Sat, 29 Sep 2001 21:11:28






>> Is there a unix (solaris) command that will return JUST the time and date
>> stamp of a file.  I hate parsing things out of  'ls'.
[...]

>Yes, you can:

>touch -t 199906042020 filename #date stamp

"return" <> "set" !

Chris Thompson
Email: cet1 [at] cam.ac.uk

 
 
 

1. Changing File Modified Time/Date Stamp

Well, maybe I don't know how our sys admin installs it.  :^)FYI, I'm using
Solaris 2.5.1

  > man touch
    ...
  SYNOPSIS
       touch [-acm] [-r ref_file] file...
       touch [-acm] [-t time] file...
       touch [-acm] [date_time] file...

But
  > touch -t 01011200 MyFile
  usage: touch [-amcf] file ...

  > which touch
  /usr/bin/touch

If
  > man -s 1b touch
    ...
  SYNOPSIS
       /usr/ucb/touch [-acfm] file...Obviously, my "touch" command and its
manpage don't match.  :^(

Which is the default "touch" in Solaris 2.5.1?  Where can I  get the "touch"
for Solaris 2.5.1 that allows me to set a specific time/date stamp, as
described in the manpage?

Hon-Chi

2. New CFV: comp.org.aix-users

3. problems with yp on 5.2

4. How do you reset file date time stamp

5. Soft-Spoken Programming

6. ftp file date / time stamp missing

7. Genius RS-232C mouse works on SS-IPC, now what?

8. date/time of a file compare with current date/time

9. Archiving files in "date folders" based on date and time file generated

10. Time discrepancy between Linux and DOS time stamps for same file

11. Date and Time stamp to hundredths of seconds?

12. synchronize date/time stamp with ftp server