LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-25-2008, 07:20 AM   #1
Jay5487
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Rep: Reputation: 0
File creation date


So I have been reading a bit on being able to get the creation date from a file to be printed... I know you can get all this info from ls -l but I was wondering if it was possible to get the YY/MM/DD out of this....

If the creation date is not possible can you get last modification date YY/MM/DD???

I have a feeling it is not really possible from what i read just wondering if any of you guys have the inside edge to somehting

Last edited by Jay5487; 03-25-2008 at 07:34 AM.
 
Old 03-25-2008, 07:36 AM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,508

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Code:
ls -l --time-style=+%y/%m/%d | gawk '{print $6}'
or
Code:
date -d "$(stat -c %y file)" +%y/%m/%d
Please note that you can't get the creation date, since this information is not stored in Unix filesystem. You can get last modification or last access time, anyway.
 
Old 03-25-2008, 07:47 AM   #3
Jay5487
LQ Newbie
 
Registered: Mar 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you!!! I had actually just found out too! but your way is less code!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to know the command which show the date of creation of file abhi_singh4 Red Hat 6 09-16-2011 12:02 AM
file creation date prashantbhushan Linux - General 2 05-29-2007 08:32 AM
File Creation Date in linux jayukanna General 5 08-21-2006 07:08 AM
ls -al file creation date blackzone Linux - Newbie 2 08-23-2004 01:31 AM
creation date of file using the 'ls' command robt Linux - Newbie 1 03-27-2003 12:34 AM


All times are GMT -5. The time now is 02:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration