LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-25-2011, 07:48 PM   #1
dragonetti
LQ Newbie
 
Registered: Sep 2011
Posts: 18

Rep: Reputation: Disabled
find only new created files from certain date => display folder and path only


Hello, I seem to be having problems constructing the correct syntax for finding only newly created files from a certain date.

The command "must" (in my ideal situation):
  • display output must only be path and filename, nothing else
  • find onlynewly created files, not the modified ones
  • able to omit (exclude) directories, the command will run from the root point => /
  • able to pipe it to an second command (e.g. delete the results / append to text file / ...)
  • must also find newly created hidden files
  • must also find newly created (hidden) folders
  • able to specify a date from which to find the newly created files/folders (e.g. 20th October 2011 => 20-10-2011 , this last point is a luxury thing but if it can be implemented it would be great, if not, a "# days back" method is also good!

I only got this:

find ./ -type f -mtime -4 -exec ls -al {} \;
It finds newly created AND modified files up to 4 days back.

I am afraid my specifications forces the the above only to be possible in a BASH script, if that is the case, a kick in the right direction would be very welcome (or dare I ask, a fully working example for me to modify to my own needs)

Many thanks in advance!
 
Old 10-25-2011, 10:06 PM   #2
bryan641
Member
 
Registered: Mar 2011
Location: Ohio, USA
Distribution: Debian Squeeze
Posts: 40

Rep: Reputation: 14
If your file system supports it, you could use something like:
Code:
find / -newerBt "2011-10-25 21:00:00"
But ext3, for example, only stores modification (mtime), attribute modification (ctime), and access (atime), so if you're using ext3 you won't be able to distinguish modified from created.

--Bryan
 
1 members found this post helpful.
Old 10-26-2011, 01:15 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
Extending the above, there is NO create time in Unix
Quote:
Three fields in the inode structure contain the last access, change, and modification times: atime, ctime, and mtime. The atime field is updated each time the pointer to the file's data blocks is followed and the file's data is read. The mtime field is updated each time the file's data changes. The ctime field is updated each time the file's inode changes. The ctime is not creation time; there is no way under standard Unix to find a file's creation time.
Perl Cookbook; see also https://secure.wikimedia.org/wikipedia/en/wiki/Inode

The very informative man page for 'find' is here http://linux.die.net/man/1/find
I'd prob start with a simple find cmd and append some other bash cmds if required; easier to debug than all in one line eg
Code:
for file in $(find / ....)
do
   other chks here ...
done
You may(?) be able to do it with just find (except for 'create' as explained)

Good bash tutorials
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html
http://www.tldp.org/LDP/abs/html/

Welcome to LQ
 
1 members found this post helpful.
Old 10-26-2011, 08:24 AM   #4
dragonetti
LQ Newbie
 
Registered: Sep 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Thank you Bryan and Chris,

After trying the command provided by Chris I got the following message:
"This system does not provide a way to find the birth time of a file."

Which led me to search on: "linux birth time of a file" => I did a google search and came back on linuxquestions on the following topic:
http://www.linuxquestions.org/questi...-linux-473684/

After reading Bryan's comment I see the "lmitation" and I can use those provided links!
Thanks!

If it's alright I want to keep this topic open for a few more days and then close it, maybe someone else has some tips/work-arounds?
I'll close it friday if this is ok?

Thanks again!
 
Old 10-26-2011, 02:46 PM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,986
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
I'm afraid even w/ scripting you won't have much fun as Linux
doesn't know anything about creation time-stamps. If they
are crucial for whatever you're doing you may want to use
kernel auditing, or maybe an inotify-script to keep track of
creations, and write those to an easily parseable file.



Cheers,
Tink

Last edited by Tinkster; 10-26-2011 at 02:56 PM.
 
1 members found this post helpful.
Old 10-27-2011, 10:38 AM   #6
dragonetti
LQ Newbie
 
Registered: Sep 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
No use to keep this open, thanks everyone for the info.
Looks like I have to take a different route.
 
  


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
finding files that were created before a certain date basher400 Linux - Newbie 2 06-16-2009 02:46 AM
Sort files under a folder by created date Kunsheng Programming 3 05-11-2009 04:58 AM
find out the files created on a particular date. ZAMO Linux - General 3 02-08-2008 01:38 AM
How to - list files that were created aftre certain date kaprasanna Linux - Newbie 2 12-10-2007 03:50 AM
Date interrogation for files created chunky Linux - General 2 08-03-2004 03:31 PM


All times are GMT -5. The time now is 11:18 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