If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > how to get file modification time and date(including year) in solaris?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-19-03, 16:43
msr20 msr20 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
how to get file modification time and date(including year) in solaris?

How can I get the last modification time and date (mmm/dd/year) of a file in Solaris.

In Linux you can find out the full time and date of a file by typing
ls --full-time command.

How can I get the same info in Solaris?

Thanks!!!!!!!!
Reply With Quote
  #2 (permalink)  
Old 11-20-03, 07:48
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Re: how to get file modification time and date(including year) in solaris?

Quote:
Originally posted by msr20
How can I get the last modification time and date (mmm/dd/year) of a file in Solaris.

In Linux you can find out the full time and date of a file by typing
ls --full-time command.

How can I get the same info in Solaris?

Thanks!!!!!!!!
Hi,

Please check with "ls -lu".

Gustavo.
Reply With Quote
  #3 (permalink)  
Old 11-21-03, 00:51
msr20 msr20 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
In linux, If you type "ls --full-time", it includes the year in the file last modification time. If you type "ls -l" , it won't not display the year for recent files. Example of "ls --full-time" :

drwx------ 2 msr20 students 4096 Wed Nov 19 23:14:04 2003 file1

drwx------ 2 msr20 students 4096 Thu Nov 20 23:30:31 2003 file2

But in Solaris, "ls --full-time" switch option is not available. I tried
"ls -lu" , it still does not dispaly the year. By the way -u option is used to get the use time of last access instead of last modification time of a file.

In above example , if you type " ls -l" instead of using the "--full-time" option, the year will not be displayed. I need the year.
drwx------ 2 msr20 students 4096 Nov 19 23:14 test
drwx------ 2 msr20 students 4096 Nov 20 23:30 test2

Is there a way to get the last modification of a file that includes the year along with month, day, and time in Solaris?

Thanks!!!!!!!!
Reply With Quote
  #4 (permalink)  
Old 11-21-03, 07:08
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Quote:
Originally posted by msr20
In linux, If you type "ls --full-time", it includes the year in the file last modification time. If you type "ls -l" , it won't not display the year for recent files. Example of "ls --full-time" :

drwx------ 2 msr20 students 4096 Wed Nov 19 23:14:04 2003 file1

drwx------ 2 msr20 students 4096 Thu Nov 20 23:30:31 2003 file2

But in Solaris, "ls --full-time" switch option is not available. I tried
"ls -lu" , it still does not dispaly the year. By the way -u option is used to get the use time of last access instead of last modification time of a file.

In above example , if you type " ls -l" instead of using the "--full-time" option, the year will not be displayed. I need the year.
drwx------ 2 msr20 students 4096 Nov 19 23:14 test
drwx------ 2 msr20 students 4096 Nov 20 23:30 test2

Is there a way to get the last modification of a file that includes the year along with month, day, and time in Solaris?

Thanks!!!!!!!!
Hi,

I think that, in Unix, all files and directory that be into calendar year not show the year.

Gustavo.
Reply With Quote
  #5 (permalink)  
Old 11-21-03, 10:31
skd skd is offline
Registered User
 
Join Date: Sep 2003
Posts: 71
if files are less than sixmonths old then calendar year is not displayed using ll command., otherwise yr shows ( atleast on HP-UX )
Reply With Quote
  #6 (permalink)  
Old 11-22-03, 15:16
msr20 msr20 is offline
Registered User
 
Join Date: Nov 2003
Posts: 3
Thanks for your response. I used Perl script to get the last modification time of a file. I guess, it is not possible using shell script. I used the stat function to solve my problem. If you type man stat, it shows you how you can get this information.

Thanks!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On