Add file creation date as new column


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Add file creation date as new column
# 1  
Old 08-30-2013
Add file creation date as new column

Hi ,

I have a requirement to append file creation date to each row in a file for all the files in a directory.
Please help

Thanks,
Pavan
# 2  
Old 08-30-2013
Although some filesystems do have a file creation timestamp, most do not. The standards only require three timestamps for files (last access timestamp, last data modification timestamp, and last status change timestamp). Many people incorrectly refer to the last status change timestamp as the file creation timestamp, but it is marked for update to the current time not only when a file is first created but also whenever the size of the file changes, the mode of the file changes, or the ownership of the file changes.

By default ls -l displays the last data modification timestamp, ls -lu displays the last access timestamp, and ls -lc displays the last status change timestamp.
# 3  
Old 08-31-2013
Allowing for Don Cragun's caveat and using his approximation, you can try
Code:
awk 'FNR==1 {("stat -c%z " FILENAME) | getline t; split (t, T)}  {print $0, T[1]}' *

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sftp file creation date and time

Hi Team, How to get the file creation date and time in SFTP server we can able to type ls -ltr command only SFTP server. Generally we type ls --full-time test.txt we will get the date and time , same way how to do in SFTP server after connected. Thanks (1 Reply)
Discussion started by: bmk123
1 Replies

2. UNIX for Dummies Questions & Answers

Change File Creation Date On Solaris

Dear Masters, I am using solaris 10. There is a requirement if a file created on Feb 1 or Feb 2, the creation date will be changed to Jan 31. Is there any command on Solaris to do that? Thanks, Kris (1 Reply)
Discussion started by: kris.adrianto
1 Replies

3. Shell Programming and Scripting

Need to add a date column (today's date) in file

Hi I have file with number status and date1 and date1 field, want add a column today between column date1 and date2. file1.txt number status date1 date2 ===== ==== === ===== 34567 open 27/06/13 28/06/13 45678 open 27/06/13 28/06/13 43567 open 27/06/13 28/06/13 ... (1 Reply)
Discussion started by: vijay_rajni
1 Replies

4. Emergency UNIX and Linux Support

Trying to add currrent date as the first the first column in the file

Hi Experts, I am trying to add one variable value as the first value in a file speparated by "" (space) delimiter. Can you please let me know how I can do this using bash script. Following is my file. 1635 ABCD 3m9ka COMPLETE 0526 AJAY 3m1da COMPLETE 0419 INDIA 3m3zi INCOMPLETE The... (3 Replies)
Discussion started by: ajaypatil_am
3 Replies

5. Shell Programming and Scripting

finding creation date of a file

Hi, Can anyone tell me a process to find the creation date of a file in a directory. If suppose I have a file in a directory created in 2009 -rw-r--r-- 1 xyz guest 2480 Jul 16 2009 sample.txt The command should return the the file creation date as 16/07/2009 thanks, (2 Replies)
Discussion started by: swathich
2 Replies

6. Shell Programming and Scripting

how to find creation date of file

Hi, I just need to know way of getting date of file when it was created. eg i have a file abc created on 23 aug. Now i need to know date of file i.e. 23 aug. How can i get that data. Thanks Sarbjit (7 Replies)
Discussion started by: sarbjit
7 Replies

7. Shell Programming and Scripting

How to get File creation date.

Hi All, I need to get file creation date. I have to access one file who's name is like... abc.log092308 and the date changes as per current date. And i am accessing this file next day. meance in above case i will access above file on 09-24-2008 Also one problem is that this file... (2 Replies)
Discussion started by: Jeevan Salunke
2 Replies

8. UNIX for Dummies Questions & Answers

Changing Creation Date to a Prespecified Date of a File In Unix

Dear Expert, Is there a command to do that in Unix? In such a way that we don't need to actually "write" or modified the content. -- monkfan (4 Replies)
Discussion started by: monkfan
4 Replies

9. UNIX for Dummies Questions & Answers

Displaying file names before a particular creation date

Hi!! I wanna display file names which are created before/after a particular date. I wud be glad if anybody can help me out in that. Thanx Dhruv (1 Reply)
Discussion started by: dhruv_saksena
1 Replies

10. UNIX for Dummies Questions & Answers

file creation date & time

Hi All, I have some files which are creates every day using a script. I want to create a log files which does write "filename,creation day and time" how can I do this ?? Alice (3 Replies)
Discussion started by: alisevA3
3 Replies
Login or Register to Ask a Question