File created time


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users File created time
# 1  
Old 03-22-2007
File created time

I have lot .log files in a directory.I need to take the one got created today.Is there any way to get the time of creation of a file?
# 2  
Old 03-22-2007
Quote:
Originally Posted by yakyaj
I have lot .log files in a directory.I need to take the one got created today.Is there any way to get the time of creation of a file?
Use "ls" with "-t" option.
# 3  
Old 03-23-2007
time of creation of files in not stored in UNIX. you may use time of modification instead.

ls -ltr lists the most recently modified files at the bottom

-l long listing
-t sort by modification time
-r reverse the order of sorting
# 4  
Old 03-23-2007
Assume we are creating file with modification times as,
Code:
touch -mt 200703231930.22 t4
touch -mt 200703232130.22 t3
touch -mt 200703231230.22 t1
touch -mt 200703201230.22 t2

Now Let us ensure the time stamp of the files,
Code:
ls -ltr t*
-rw-r-----   1 usera  groupa           0 Mar 20 12:30 t2
-rw-r-----   1 usera  groupa           0 Mar 23 12:30 t1
-rw-r-----   1 usera  groupa           0 Mar 23  2007 t4
-rw-r-----   1 usera  groupa           0 Mar 23  2007 t3


Now using the find command,as below u can list out the files modified within 1 day
Code:
find . -name '*' -mtime -1 -ls
  1498976    0 -rw-r-----   1 usera  groupa            0 Mar 23 12:30 ./t1
  1499624    0 -rw-r-----   1 usera  groupa            0 Mar 23  2007 ./t3
  1500510    0 -rw-r-----   1 usera  groupa            0 Mar 23  2007 ./t4

Please check if this works in your case.

Thanks
Nagarajan Ganesan.

Last edited by rbatte1; 08-09-2016 at 05:13 AM.. Reason: Added CODE tags
# 5  
Old 03-23-2007
Many thanks for your replies.I tried find but the problem is it will list all the files that got modified for the past one day.I want only files created on that particular day.Am doing a grep for date for that day to get it.Dont know it is good or bvetter ways are there.

Once again many thanks for your help
# 6  
Old 03-23-2007
Code:
find /path/to/files -type f -mtime -1

list files in the directory /path/to/files that were last modified 23:59:59 and less, ie. the last day.
# 7  
Old 03-23-2007
Unix does not track the creation date of files. For a good explanation, see Perderabo's thread:

https://www.unix.com/tips-and-tutorials/20526-mtime-ctime-atime-post79750.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find if create time of last created file in a directory is older than 5 minutes

A process xyz is running and creating file1, file2, file3, .... filen. how do i know if the process has stopped and createtime of the last file (filen) is older than 5 minutes? OS is AIX (3 Replies)
Discussion started by: malaika
3 Replies

2. Shell Programming and Scripting

How to send a file in UNIX through email which is created only 15 minutes before the current time?

I wanted to send an email to the client whenever there is failed record created in a /feed/HR-76/failed folder after processing of feed file. I can find out with the help of below script that what is the new file created but that file didn't make just 15 minutes before. ... (1 Reply)
Discussion started by: puneetkhullar
1 Replies

3. Shell Programming and Scripting

Segregate files based on the time they are created

Hi All, I have scenario where I need to zip huge number of DB audit log files newer than 90 days and delete anything older than that. If the files are too huge in number,zipping will take long time and causing CPU spikes. To avoid this I wanted to segregate files based on how old they are and... (2 Replies)
Discussion started by: veeresh_15
2 Replies

4. UNIX for Dummies Questions & Answers

At jobs - created date and time

Hi, I'm running atq for a user and its showing 2 'at' jobs in the queue to start at a later time. > atq Is there any way i can find out the creation date/time of these jobs? and ideally what job created them and what script(s) they are going to run? All i can see is the job number and... (3 Replies)
Discussion started by: finn
3 Replies

5. Shell Programming and Scripting

Files created on specific time

Hello Gurus, I am facing one issue to get a file for a specific time. There are about 300 files created between 6.30 pm to 7.15 pm everyday. Now I wanted only the file which is created on 6.45pm. No other files required. I have used "find" command to get the files, but not getting the expected... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

6. Shell Programming and Scripting

Capture time of File last created.

Hi .. I have a list of filenames in a particular file. All thse files get generated in the same directory. No w i want to find out which of thse got generated last and capture that time . Have written a while loop but seems getting struck ... while read line do if then rvst_capt_time=... (7 Replies)
Discussion started by: ultimatix
7 Replies

7. UNIX for Dummies Questions & Answers

how to know what time one user was created?

I am using RHEL. I wan to know the creation time of one user? which command? (4 Replies)
Discussion started by: cqlouis
4 Replies

8. Shell Programming and Scripting

Copying files created after a specified date/time

I need to write a script that copies files from one directory to another that were created after "today 6:30". This script will be NOT be ran at the same time each day. any help is appreciated. (2 Replies)
Discussion started by: jm6601
2 Replies

9. Shell Programming and Scripting

query for a file created at a particular time

Hi guys I need to find out a file created at 'x' time and the name of the file is rag.rxt 100's of these files are created every minute and i dont know how to find the file created at a particular time. pls help me with the command to search that. thanks in advance (2 Replies)
Discussion started by: ragha81
2 Replies

10. Shell Programming and Scripting

Determine date and time the file was created through shell scripts

Can I determine when the particular file was created, in korn-shell. Can please someone help me. If possible please mail the solution to me. my mail id: bharat.surana@gmail.com (1 Reply)
Discussion started by: BharatSurana
1 Replies
Login or Register to Ask a Question