LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 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
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
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
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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
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

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

All times are GMT -5. The time now is 06:05 PM.

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