How to get year part from file created date?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to get year part from file created date?
# 1  
Old 01-15-2014
How to get year part from file created date?

Hi Gurus,

I need to get year part of file created date. when using
Code:
ls -l

, it only show month, day and time.
is there any option I can add to get year portition?

Thanks in advance
# 2  
Old 01-15-2014
Please post an example of what you are seeing.


ls -al should give you the long listing.
# 3  
Old 01-15-2014
Quote:
Originally Posted by graphi
Please post an example of what you are seeing.


ls -al should give you the long listing.
when using
Code:
 ls -al

I got below.
Code:
-rw-r--r--   1 abc   abc         0 Jan 14 16:56 abcde
-rw-r--r--   1 abcd  abc         0 Jan 14 16:56 abcdef

but I need to know which year the file created. in current list, I can only see month and day.

Thanks
# 4  
Old 01-15-2014
Code:
ls --full-time

# 5  
Old 01-15-2014
ls -E will also give the full date, and full time down to the nano-second.
This User Gave Thanks to graphi For This Post:
# 6  
Old 01-15-2014
Quote:
Originally Posted by in2nix4life
Code:
ls --full-time

Thanks for your repsonse.
my unix box is Solaris. it seems the command doesn't work. it pop up error;
Code:
ls: illegal option -- full-time
usage: ls -1RaAdCxmnlhogrtuvVcpFbqisfHLeE@ [files]

any idea about this?

Thanks
# 7  
Old 01-15-2014
Use -E option:
Code:
-E           The same as -l, except  displays  time  to  the
             nanosecond  and  with  one format for all files
             regardless  of age: yyyy-mm-dd hh:mm:ss.nnnnnnnnn (ISO 8601:2000 format).

This User Gave Thanks to Yoda For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Delete all files created in specific year

I have more than 200K files created in year 2017 under directory having size of 50GB. I want to all these files in one shot. Is there any faster option available with find command to delete all these file ? (6 Replies)
Discussion started by: sp23029
6 Replies

2. Shell Programming and Scripting

Find the file created on current date

Hi All, I'm trying to find a file which is created on current day.... I searched in unix.com and i found, below command. find /land/ -mtime -1 -type f -print | grep "FF_Member_STG.dat" The command checks if the file with name "FF_Member_STG.dat" is created today then exit else proceed. ... (3 Replies)
Discussion started by: ace_friends22
3 Replies

3. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

4. UNIX for Dummies Questions & Answers

Can we change the file created date?

Hi, I am creating a file in unix today. Is it possible to make the file created as 2 days older (or some past date)? P.S: i dont want to change the system date to older one and try.:rolleyes: Thanks, Pandeeswaran (6 Replies)
Discussion started by: pandeesh
6 Replies

5. Shell Programming and Scripting

Rename File Based on Created Date

I am trying to rename files based on the created/born date of the file. I Have a total of 4000 files that i am trying to do this with and would like it to be log_yyyymmddhh.gz right now the files are maillog.???.gz. Can anyone point me in the right direction of how to get this done via scipt? ... (4 Replies)
Discussion started by: Paulb
4 Replies

6. Shell Programming and Scripting

File created year

Hi I need to get the File creation date (MM,DD,YYYY) using ls -ltr am getting only Month and Day only, I need year also when the file is modified. Thanks (3 Replies)
Discussion started by: KiranKumarKarre
3 Replies

7. UNIX for Dummies Questions & Answers

Finding the date a file was created

how do i find the date a file was created? (3 Replies)
Discussion started by: trob
3 Replies

8. UNIX for Dummies Questions & Answers

Create Year directory, date subdirectory and archive the file

Hi, After checking all the UNIX threads, I am able to come up with a solution so far. I am working on a shell script where it moves the files to a certain directory. The conditions to check are 1) Check if the file exists in the current directory. 2) Check if the destination directory... (2 Replies)
Discussion started by: madhunk
2 Replies

9. Shell Programming and Scripting

Need to find created date of file in UNIX

I need to write a script which has to list all the files which are created before six months from now. kindly help on this ... (7 Replies)
Discussion started by: amirthraj_12
7 Replies

10. UNIX for Dummies Questions & Answers

File management based on date created

Hi There, I was wondering how to manage files (ie. rm, cp , mv) based on date last modified and date created. ie. Say i want to: mv ./* ./temp/* (where the date created < 29/1/2006 ) or mv ./* ./temp/* (where the date modified > 27/1/2006 && date modified < 29/1/2006) Thanks in... (1 Reply)
Discussion started by: Geehog_Rare
1 Replies
Login or Register to Ask a Question