LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 05-04-2010, 11:01 PM   #1
mech123
Member
 
Registered: Dec 2008
Posts: 36

Rep: Reputation: 16
fileListing command for last 24 hrs


Actuaaly i am creating watch on one directory in which files are continuously coming.Is there any command which can give listing of all files who have come in last 24 hrs.
 
Old 05-05-2010, 12:12 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

Have a look at the find command, more in particular -amin, -atime, -mmin and -time options.
Code:
man find
Kind regards,

Eric
 
Old 05-05-2010, 12:25 AM   #3
linuxunix
Member
 
Registered: Mar 2010
Location: California
Distribution: Slackware
Posts: 235

Rep: Reputation: 18
find /path -type f -mtime -1
 
Old 05-05-2010, 03:24 AM   #4
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
I already checked this find option but it is not fulfulling my query.
for eg. i used command find -amin 360,it gives me all files which are accessed in last 6hrs.But Sir,what if a file comes in directory 6hrs ago and in last 6hrs user use vi command to open the file. then this file will also come in listing but this file came in directory 6hr ago,which i dont want bcz i only want lising of those files which came in directory in last 6hrs.
 
Old 05-05-2010, 06:33 AM   #5
Andrew Dufresne
LQ Newbie
 
Registered: Sep 2009
Distribution: Fedroa 10
Posts: 27

Rep: Reputation: 16
Quote:
Originally Posted by mech123 View Post
I already checked this find option but it is not fulfulling my query.
for eg. i used command find -amin 360,it gives me all files which are accessed in last 6hrs.But Sir,what if a file comes in directory 6hrs ago and in last 6hrs user use vi command to open the file. then this file will also come in listing but this file came in directory 6hr ago,which i dont want bcz i only want lising of those files which came in directory in last 6hrs.
How about keeping track of the processes that have accessed files in that folder, through a script? Now, if we find that the file has been accessed by 'vi' in the last 6 hours, then we will know its not the one we need.

Can you change the destination folder of the files? I mean, now files come into folder abc. We change the settings and make them come to folder xyz.
Initially xyz folder will be empty.
We run a loop, that we will keep looking for files in xyz. Once it sees a file in it, it will add its name and time into a file LOG. Then it will move it to abc folder.
Once the file is in abc folder, all users can access and modify it.
folder xyz is again empty.
Now to see the files that came in the last 6 hour, you can access LOG.

Hope it helps.
Regards
 
Old 05-05-2010, 09:26 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try the ctime option; this (ctime value) is set when the file is created or moved (& some other stuff) It shouldn't change for a read-only vi session.
It actually records when the dir entry for that file was changed somehow, not the file content (mtime) or last access (atime).
 
1 members found this post helpful.
Old 05-06-2010, 03:19 AM   #7
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
Sir,i checked ctime option,it is again behaving same as atime option.I did same experim. as specified earlier(vi command)and it gave me same result.Any other option
 
Old 05-10-2010, 07:03 AM   #8
mech123
Member
 
Registered: Dec 2008
Posts: 36

Original Poster
Rep: Reputation: 16
Waiting for reply
 
Old 05-10-2010, 11:51 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
No, if you only read the file in vim and do NOT change it at all, the ctime is not affected (the atime will be affected; the mtime is also affected if you edit the file content); see the -c option to ls eg

ls -ltc yourfile

http://linux.die.net/man/1/ls
 
1 members found this post helpful.
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
24 hrs TimeZone santhosh23 Linux - General 1 11-05-2007 02:27 PM
less than 24 hrs into linux and i already broke something lejakl Linux - Software 7 07-31-2003 10:47 AM
2 day challenge starts in 12 hrs! slipsy Linux - Networking 5 04-20-2003 11:43 PM
Disconnect after 2 hrs on idle bernstar77 Linux - Networking 0 11-26-2001 01:37 PM
Clock 4 hrs off at start up mike L Linux - General 13 07-16-2001 07:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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