![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change created and modification time if symbolic links | avanigadhai | Filesystems, Disks and Memory | 1 | 02-28-2008 01:07 AM |
| Copying files created after a specified date/time | jm6601 | Shell Programming and Scripting | 2 | 11-28-2007 09:29 AM |
| List files created between specific date and time | jazjit | Shell Programming and Scripting | 3 | 04-26-2007 10:19 PM |
| query for a file created at a particular time | ragha81 | Shell Programming and Scripting | 2 | 01-26-2007 07:49 AM |
| Determine date and time the file was created through shell scripts | BharatSurana | Shell Programming and Scripting | 1 | 01-11-2006 09:06 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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?
|
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|
|||
|
Assume we are creating file with modification times as,
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, 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 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. |
|
|||
|
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 |
|
|||
|
Unix does not track the creation date of files. For a good explanation, see Perderabo's thread:
http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html#post79750 |
|||
| Google UNIX.COM |