List year for a Folder | Unix Linux Forums | HP-UX

  Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

List year for a Folder

HP-UX


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 07-11-2013
mohtashims mohtashims is offline
Registered User
 
Join Date: Jun 2011
Last Activity: 18 April 2014, 7:54 AM EDT
Posts: 327
Thanks: 73
Thanked 0 Times in 0 Posts
Oracle List year for a Folder

Hi,

I am trying to list the year for this folder but it does not show.

See output:

Code:
==> ls -ltrde default
drwxr-xr-x   2 bea        /tmp       8192 Jul 10 22:56 default

Any reasons ?

Instead of showing year it shows 22:56. Why ?
Sponsored Links
    #2  
Old 07-11-2013
vidyadhar85's Avatar
vidyadhar85 vidyadhar85 is offline Forum Advisor  
The Tutor
 
Join Date: Jun 2008
Last Activity: 9 April 2014, 1:31 AM EDT
Location: INDIA, Bangalore
Posts: 2,049
Thanks: 16
Thanked 107 Times in 103 Posts
Behaviour of ls is such that the year is displayed only for files older than 6 months. If you want the year for files less than 6 months old, you will have to write a program either in C/perl/python that does the task.

if you have --time-style in your ls man page you can display year with ls --full-time

perl command..


Code:
 
perl -e '@d=localtime ((stat(shift))[9]); printf "%02d-%02d-%04d %02d:%02d:%02d\n", $d[3],$d[4]+1,$d[5]+1900,$d[2],$d[1],$d[0]' file


Last edited by vidyadhar85; 07-11-2013 at 05:18 AM..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
List of files in a folder inclusive subfolder Subhasis Shell Programming and Scripting 2 11-28-2012 06:03 AM
dtterm to list a folder contents in new window golfcents UNIX for Dummies Questions & Answers 4 06-03-2011 07:41 PM
List certain file in a folder and make list andrisetia UNIX for Dummies Questions & Answers 1 09-15-2008 01:21 PM
Need year to display from ftped files list Vrgurav Shell Programming and Scripting 1 03-04-2008 10:01 AM
trying to list everything in a folder except . and .. dkieran Shell Programming and Scripting 2 05-16-2007 07:09 PM



All times are GMT -4. The time now is 08:09 AM.