Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date/Time on a File

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
Is there a unix command that will give me the date/time of a file? Or is a script needed that utilizes "ls" to manipulate an output..

Thanks
je
 
think of it this way, that is something you can brag about being a script writer.
 
I use this Perl fragment to do it:

Code:
#!/usr/bin/perl
if ($#ARGV < 0) {
        print &quot;usage: filedate.pl <filespec>\n&quot;;
} else {
        print localtime((stat($ARGV[0]))[9]) . &quot;\n&quot;;
}

I'm not as cruel as cruel. :)

Annihilannic.
 
hink this is what your looking for...

ls -l |nawk '{printf &quot;%-25 s %-5s %-5s%s\n&quot;, $9 , $6 , $7 , $8 ;}'


Of course I could be wrong...;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top