file date stamp

file date stamp

Post by fredflinstonebo.. » Sat, 23 Jul 2005 01:08:35



i am trying to get the file modification TIME (hh:mm) for files which
were created more than 6 months ago.  however, when doing a "ls"
command, files which were created more than 6 months ago do not show
the TIME but rather the YEAR.  for example:

-rw-r--r--   1 fred     17727 Jan 19  2005 1.txt
-rw-r--r--   1 fred     45116 Jan 19  2005 2.txt
-rw-r--r--   1 fred     42858 Jan 20  2005 3.txt
-rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
-rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt
-rw-r--r--   1 fred     19529 Jan 24 17:29 6.txt
-rw-r--r--   1 fred     38632 Jan 24 23:01 7.txt
-rw-r--r--   1 fred     48671 Jan 25 20:39 8.txt
-rw-r--r--   1 fred     48593 Jan 26 19:59 9.txt

file "4.txt" has a file modification time of "Jan 21 2005".  instead of
"2005", i really want the hour and minute.  is there anyway to obtain
this?

 
 
 

file date stamp

Post by Ed Morto » Sat, 23 Jul 2005 03:51:39



> i am trying to get the file modification TIME (hh:mm) for files which
> were created more than 6 months ago.  however, when doing a "ls"
> command, files which were created more than 6 months ago do not show
> the TIME but rather the YEAR.  for example:

> -rw-r--r--   1 fred     17727 Jan 19  2005 1.txt
> -rw-r--r--   1 fred     45116 Jan 19  2005 2.txt
> -rw-r--r--   1 fred     42858 Jan 20  2005 3.txt
> -rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
> -rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt
> -rw-r--r--   1 fred     19529 Jan 24 17:29 6.txt
> -rw-r--r--   1 fred     38632 Jan 24 23:01 7.txt
> -rw-r--r--   1 fred     48671 Jan 25 20:39 8.txt
> -rw-r--r--   1 fred     48593 Jan 26 19:59 9.txt

> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
> "2005", i really want the hour and minute.  is there anyway to obtain
> this?

Take a look at the GNU "stat" and "find" man pages.

Regards,

        Ed.

 
 
 

file date stamp

Post by GH Snijder » Sat, 23 Jul 2005 04:45:19



> i am trying to get the file modification TIME (hh:mm) for files which
> were created more than 6 months ago.  however, when doing a "ls"
> command, files which were created more than 6 months ago do not show
> the TIME but rather the YEAR.  for example:

[...]

Quote:> -rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
> -rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt

[...]

Quote:> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
> "2005", i really want the hour and minute.  is there anyway to obtain
> this?

From man ls:
       --full-time
              list both full date and full time

For the filtering on age, check out the -mtime option of find.

HTH, HAND

mvg,
   Guus

 
 
 

file date stamp

Post by Chris F.A. Johnso » Sat, 23 Jul 2005 04:59:50




>> i am trying to get the file modification TIME (hh:mm) for files which
>> were created more than 6 months ago.  however, when doing a "ls"
>> command, files which were created more than 6 months ago do not show
>> the TIME but rather the YEAR.  for example:

> [...]

>> -rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
>> -rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt

> [...]

>> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
>> "2005", i really want the hour and minute.  is there anyway to obtain
>> this?

> From man ls:
>        --full-time
>               list both full date and full time

    Only with the GNU version.

    If you have the GNU utilities, there is stat, which allows a
    format string describing the information you want printed. There
    is a similar utility on *BSD; the name is the same, but the syntax
    is different.

    Also, the GNU date program can print the timestamp, formatted as
    you like, from a file with the -r option:

$ ls -l 4711c07_toAR.doc
-rw-rw-r--  1 chris 1000 62976 Jan 10  2005 4711c07_toAR.doc
$ date -r 4711c07_toAR.doc "+%Y-%m-%d %H:%M:%S"
2005-01-10 23:05:21
$ stat -c "%y" 4711c07_toAR.doc
2005-01-10 23:05:21.000000000 -0500

--
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>

 
 
 

file date stamp

Post by Michael Tosc » Sat, 23 Jul 2005 05:07:44



> i am trying to get the file modification TIME (hh:mm) for files which
> were created more than 6 months ago.  however, when doing a "ls"
> command, files which were created more than 6 months ago do not show
> the TIME but rather the YEAR.  for example:

> -rw-r--r--   1 fred     17727 Jan 19  2005 1.txt
> -rw-r--r--   1 fred     45116 Jan 19  2005 2.txt
> -rw-r--r--   1 fred     42858 Jan 20  2005 3.txt
> -rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
> -rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt
> -rw-r--r--   1 fred     19529 Jan 24 17:29 6.txt
> -rw-r--r--   1 fred     38632 Jan 24 23:01 7.txt
> -rw-r--r--   1 fred     48671 Jan 25 20:39 8.txt
> -rw-r--r--   1 fred     48593 Jan 26 19:59 9.txt

> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
> "2005", i really want the hour and minute.  is there anyway to obtain
> this?

perl can do it:

\ls | perl -ne \

--

 
 
 

file date stamp

Post by Michael Heimin » Sat, 23 Jul 2005 05:17:40





>>> i am trying to get the file modification TIME (hh:mm) for files which
>>> were created more than 6 months ago.  however, when doing a "ls"

[..]

Quote:>>> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
>>> "2005", i really want the hour and minute.  is there anyway to obtain
>>> this?

>> From man ls:
>>        --full-time
>>               list both full date and full time
>    Only with the GNU version.

The culprit about the OP, there's no mention about which *nix is
used so we don't know.

Quote:>    If you have the GNU utilities, there is stat, which allows a
>    format string describing the information you want printed. There
>    is a similar utility on *BSD; the name is the same, but the syntax
>    is different.
>    Also, the GNU date program can print the timestamp, formatted as
>    you like, from a file with the -r option:

Perhaps more portable (untested) but time consuming:

tar -cf - file | tar -tvf -

[..]

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)

#bofh excuse 442: Trojan horse ran out of hay

 
 
 

file date stamp

Post by Bill Marcu » Sat, 23 Jul 2005 05:26:11


On Thu, 21 Jul 2005 13:51:39 -0500, Ed Morton


>> i am trying to get the file modification TIME (hh:mm) for files which
>> were created more than 6 months ago.  however, when doing a "ls"
>> command, files which were created more than 6 months ago do not show
>> the TIME but rather the YEAR.  for example:

>> -rw-r--r--   1 fred     17727 Jan 19  2005 1.txt
>> -rw-r--r--   1 fred     45116 Jan 19  2005 2.txt
>> -rw-r--r--   1 fred     42858 Jan 20  2005 3.txt
>> -rw-r--r--   1 fred    115713 Jan 21  2005 4.txt
>> -rw-r--r--   1 fred    101056 Jan 22 15:22 5.txt
>> -rw-r--r--   1 fred     19529 Jan 24 17:29 6.txt
>> -rw-r--r--   1 fred     38632 Jan 24 23:01 7.txt
>> -rw-r--r--   1 fred     48671 Jan 25 20:39 8.txt
>> -rw-r--r--   1 fred     48593 Jan 26 19:59 9.txt

>> file "4.txt" has a file modification time of "Jan 21 2005".  instead of
>> "2005", i really want the hour and minute.  is there anyway to obtain
>> this?

> Take a look at the GNU "stat" and "find" man pages.

Or, if you have the GNU version of ls, "ls --full-time".

--
Tonight you will pay the wages of sin; Don't forget to leave a tip.

 
 
 

file date stamp

Post by fredflinstonebo.. » Sat, 23 Jul 2005 05:40:16


thanks for all the suggestions.  The Unix OS version I am using is
Tru64 OSF1 V4.0F.  I'm not so quick with C or perl, so if anyone can
provide me a Unix command(s) that I can just type at the prompt, that
would be easiest for me, if it is possible.
 
 
 

file date stamp

Post by Chris F.A. Johnso » Sat, 23 Jul 2005 06:09:50



> thanks for all the suggestions.  The Unix OS version I am using is
> Tru64 OSF1 V4.0F.  I'm not so quick with C or perl, so if anyone can
> provide me a Unix command(s) that I can just type at the prompt, that
> would be easiest for me, if it is possible.

   What was wrong with the suggestions you have received?

    Please quote enough of the post you are replying to to give the
    context of your own post. This is Usenet, not a web forum (though
    it is also bastardized on several web sites, including Google
    groups).

       "If you want to post a followup via groups.google.com, don't
        use the broken "Reply" link at the bottom of the article.
        Click on "show options" at the top of the article, then click
        on the "Reply" at the bottom of the article headers."
                                                     - Keith Thompson
--
    Chris F.A. Johnson                     <http://cfaj.freeshell.org>
    ==================================================================
    Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
    <http://www.torfree.net/~chris/books/cfaj/ssr.html>

 
 
 

file date stamp

Post by johngnu » Sat, 23 Jul 2005 06:23:45


Some OS's support a  handy option in find, try:
 `find . -ls .

JB

 
 
 

file date stamp

Post by Michael Heimin » Sat, 23 Jul 2005 06:23:17



Quote:> thanks for all the suggestions.  The Unix OS version I am using is
> Tru64 OSF1 V4.0F.  I'm not so quick with C or perl, so if anyone can
> provide me a Unix command(s) that I can just type at the prompt, that
> would be easiest for me, if it is possible.

Well, it looks like you already got two commands which should do
the trick (hopefully).

 tar -cf - * | tar -tvf -

 \ls | perl -ne \

(Michael Tosch)

It's up to you testing them out. There have been additional GNU
software CDs available containing most GNU software others
mentioned in this thread, for 4.0F. Dunno if you can still get
them, if you are authorized to install things?

Good luck

BTW
You are replying from google groups in its default way which does
not quote the text you are replying to.  This makes it harder for
people not using google groups to help you, while at the same
time annoying regulars on a daily basis. IIRC there is an option
to show text and then you can use the reply button at the bottom.

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)

#bofh excuse 239: CPU needs bearings repacked

 
 
 

file date stamp

Post by fredflinstonebo.. » Sat, 23 Jul 2005 22:21:59


Quote:> Well, it looks like you already got two commands which should do
> the trick (hopefully).

>  tar -cf - * | tar -tvf -

thanks.  this one worked quite well.  another person earlier had also
suggested this, but I was afraid to try it because i thought it was
going to tar up my files.

>  \ls | perl -ne \

> (Michael Tosch)

i tried this one, but perl is not installed on my machine.

Quote:> You are replying from google groups in its default way which does
> not quote the text you are replying to.  This makes it harder for
> people not using google groups to help you, while at the same
> time annoying regulars on a daily basis. IIRC there is an option
> to show text and then you can use the reply button at the bottom.

sorry to annoy everyone.  hope i did it right this time.  my office
mate just clued me in on a newsgroup program i should use instead of
google.  thanks for all the help.  this is great to have the help of
others.  happy friday.
 
 
 

file date stamp

Post by Michael Tosc » Sun, 24 Jul 2005 01:50:19



>>Well, it looks like you already got two commands which should do
>>the trick (hopefully).

>> tar -cf - * | tar -tvf -

> thanks.  this one worked quite well.  another person earlier had also
> suggested this, but I was afraid to try it because i thought it was
> going to tar up my files.

It does tars all file data into the pipe buffer.
This is a temporary buffer in memory only, but if your files are many
GB big, the many GB will transfer to memory, while you only want some
meta-data.
Nevertheless, the tar solution is ok if you dont run this often and if
you have small files.

The perl code (and all solutions with "stat") only reads the meta-data:

>> \ls | perl -ne \

>>(Michael Tosch)

> i tried this one, but perl is not installed on my machine.

Download perl from e.g.
http://www.tru64.org/pages.php?page=Software

--

 
 
 

1. dhcp info file date stamp.

I converted to use dhcp last  weekend. The "dhcpcd-eth1.info" file has
this in it.

LEASETIME=169058
RENEWALTIME=84529
REBINDTIME=147925

The date on the file is "Jan 20 22:49".
If I read this correctly, it should have renewed in approx. 24 hours.
However, the date stamp on  the file has not changed. Does it mean that
something
wrong with dhcpcd server?
Thanks.

2. tar: preserving perms for missing users

3. File date stamps

4. Linux on Mac LC III possible?

5. Date stamping commands in the shell command history file

6. blocking writes

7. Changing File Modified Time/Date Stamp

8. Hrad disk problem in dual boot install

9. Keeping With Stamped Date On Downloaded Files

10. Date stamping commands in the history file in ksh

11. How do you reset file date time stamp

12. time and date stamp of a file