LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-16-2014, 01:35 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How to find/list files modiffied/created in certain day or exaxt time?


Hello,

on linux, how i can find files created/modiffied in certain day in the past (Lets say April 30) or even in certain day + certain hour and minute? can anyone write command please?

--
so far i found:
Quote:
Example: To find all files modified on the 7th of June, 2006:

$ find . -type f -newermt 2007-06-07 ! -newermt 2007-06-08
but i need created + modiffied, not only modiffied
 
Old 07-16-2014, 03:46 AM   #2
mikeavison
LQ Newbie
 
Registered: Oct 2010
Posts: 12

Rep: Reputation: 0
I am not sure this will help, but it is the best I know (I'm not too expert)

It is unclear if you are trying to list all files anywhere or in a certain directory. The find command you posted will find files over all available file systems (unless you narrow it down)

If you just want to look in a directory you could pipe the result of ls through grep

e.g. ls -l |grep 2004

would list all the files in the current directory, in long format, and (after the pipe), grep will select out only those lines of output that have "2004" in the line. You can pipe results again through another grep to narrow results further

e.g. ls -l |grep 2004 |grep Apr

Your thing about modified and created: did you look in the man pages for ls ? Check option -c and -t. These options switch between reporting created and modified dates

Best Wishes
 
Old 07-19-2014, 02:29 AM   #3
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
thanks, im looking for recursive find command, possibly also the one which allows setting timeframe including hour.
 
Old 07-19-2014, 07:13 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by postcd View Post
how i can find files created/modiffied (..) in certain day + certain hour and minute?
'man find', see "printf": use epoch for creation and modification time directives together with the path and file name. That gives you a list of three columns.
'man date', see "--date=": give time stamp of hour start and print as epoch. Do same for time stamp of hour end. That gives you two epoch values.
String this together with a "while" loop, looping over the variables containing creation and modification time of 'find' output and use "-le" and "-ge" to filter for your time "range".

*Do note in UNIX, it is not possible to tell a files ctime. Plus ctime actually stands for "change time". It is the time when changes were made to the file or directory's inode (owner, permissions, etc, etc).
**Do note time stamps may be changed unless the immutable bit is set. Time stamps on their own should never be used as definitive proof of about anything.
***Also in 'man find': "-newer".
 
Old 07-19-2014, 07:45 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
In Linux, ext4 (at least) now maintaints the creation time (crtime) in the inode. Getting at it is a PITA tho' - stat under debugfs.
 
Old 07-19-2014, 01:08 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Ah, forgot that. Good one.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wget: last modiffied header missing --time-stamps turned off postcd Linux - General 1 04-18-2014 02:03 AM
Find and List Files Created in a Particular Year devUnix Linux - General 3 02-01-2011 07:32 AM
How do I list recently created/modified files? khvatov Linux - Newbie 3 03-08-2009 10:12 PM
How to - list files that were created aftre certain date kaprasanna Linux - Newbie 2 12-10-2007 03:50 AM
list all files created by another user christina_rules Linux - General 6 05-23-2006 09:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:47 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration