LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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
 
LinkBack Search this Thread
Old 01-07-2009, 08:42 AM   #1
deepti
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
Is there any other way of finding out if my file is just modified or is newly created


Hello,

The issue is that I have a flat file that gets updated at irregular intervals. A java program polls the flat file and reads the new records that have come. When the flat file exceeds some size, I rename it and create another file in its place, to which records may be populated immediately. Now the java program needs to know that the records dont need to be read from some between but right from the top as the file is new and all the records in it are unread.
My question is, how can i find in Linux, if my file is just modified or is created anew. I tried doing this with inode but the inode gets changed on modification as well as creation so there is no way of knowing. I cannot use size also.

Is there any other way of finding out if my file is just modified or is newly created.

Thanks,

Deepti.
 
Old 01-07-2009, 09:33 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu 10.04
Posts: 9,196

Rep: Reputation: 190Reputation: 190
Get the program the program that creates the new file to also set a flag which the java program looks for?
 
Old 01-07-2009, 07:43 PM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Brisbane
Distribution: Centos 6.2, Centos 5.8
Posts: 11,740

Rep: Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905Reputation: 905
Depending on how fast new data arrives in a new file compared to old file, you might be able to check if new file size < old file size.
Flag is prob safer though... as above
 
Old 01-07-2009, 10:35 PM   #4
deepti
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newly created id on LQ.... ssinlr Linux - Newbie 1 12-01-2008 10:21 PM
Created and Modified date linux2man Linux - Newbie 1 08-13-2007 12:10 PM
Make newly created file executable Black Chaos Linux - General 3 08-03-2006 10:53 AM
Newly created File/directory permissions? redrobin77 Fedora 3 11-14-2005 04:55 AM
snort error: newly created file is older than distributed files! rufassa Linux - Security 1 11-07-2003 08:53 AM


All times are GMT -5. The time now is 08:10 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
Open Source Consulting | Domain Registration