List year for a Folder


 
Thread Tools Search this Thread
Operating Systems HP-UX List year for a Folder
# 1  
Old 07-11-2013
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 ?
# 2  
Old 07-11-2013
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 06:18 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find the owner user of each folder in a list

Hello I have a file containing the list of different folders like this file_list.txt: /s8/tests/test1 /s8/tests/tests/test2 /s8/tests/test2 /s8/tests/tests/test2/test5 I want a script to put the owner user of each folder in front of it in the text file. So the reult would become... (5 Replies)
Discussion started by: Johanni
5 Replies

2. UNIX for Beginners Questions & Answers

How to list todays file in perticular folder?

How to list todays file in perticular folder Moved thread to appropriate forum (9 Replies)
Discussion started by: pspriyanka
9 Replies

3. UNIX for Dummies Questions & Answers

Unable to list folder contents

I'm unable to list the contents of a directory once I move into it. I have full permissions on this directory (called "Scripts" in the below example). The scenario is shown below in detail: Command 'ls' works fine to begin with: 1: pmn@linuxhost /home/pmn > cd /opt/smt/proiv 2:... (4 Replies)
Discussion started by: pmn
4 Replies

4. Shell Programming and Scripting

List of files in a folder inclusive subfolder

Hi, I need to list the names of existing files in a specific folder. I have written a script for that, but the problem is, it is also picking up name of a subfolder that is there in that folder. I need only the list of files and not that subfolder. How to go about that ? Can anyone plz help... (2 Replies)
Discussion started by: Subhasis
2 Replies

5. UNIX for Dummies Questions & Answers

dtterm to list a folder contents in new window

Hi everyone,:cool: thank you in advance for any help on this I have a dtterm command to open a new small terminal window with a contents of log, and it works fine. dtterm -title "my.log" -geometry =40x30+0+550 -fn 6x13 -e tail -n 40 -f /home/logs/user.log & However what I want to do... (4 Replies)
Discussion started by: golfcents
4 Replies

6. UNIX for Dummies Questions & Answers

List certain file in a folder and make list

Hi, im having problem that frustate me today. there are list of file in a folder that i want to grab the folder /subject/items/ in this folder there are this file CREATE_SUBxxxx.xml UPDATE_SUBxxxx.xml DELETE_SUBxxxx.xml loginresponsexxxxx.xml core how can i grab all the file... (1 Reply)
Discussion started by: andrisetia
1 Replies

7. Shell Programming and Scripting

Need year to display from ftped files list

Hi All, p_ftp=dummy time ftp -niv 192.0.0.2 << EOF user dummy dummy cd prt/$p_ftp ascii ls -ltr quit output is -rw-r--r-- 1 500 500 5137 Mar 04 11:21 dummy.csv can any one suggest how to get year while using ftp (1 Reply)
Discussion started by: Vrgurav
1 Replies

8. Shell Programming and Scripting

trying to list everything in a folder except . and ..

I want to list everything in a directory, including dotfiles (example .file1) except for the . and .. that are in every folder. I'm guessing it's some sort of regular expression I need. So far, I have come up with ls -a | grep That lists the .file1 file only (though I don't see why it should,... (2 Replies)
Discussion started by: dkieran
2 Replies

9. UNIX for Dummies Questions & Answers

Command to list samba shared folder in linux

Hi All, Is there any command to list samba shared folders in red hat linux 7.2 Thanks in advance Bache Gowda (0 Replies)
Discussion started by: bache_gowda
0 Replies
Login or Register to Ask a Question