• Post Reply Bookmark Topic Watch Topic
  • New Topic

hofw to find weather the file is already red or not..

 
lokesh rajarathnam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all..

I had list of files, how can i find the file is already red or not... if red i need to go for next file else current one has to read..

Thanks....
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you mean "read", not "red".

What does it mean for a file to have been read? Read by whom? In general it's not possible to find out whether a file has been read by some other process or not, unless special provisions are made for that.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
I assume you mean "read", not "red".




To add to what Ulf has told.
There is no straight forward way of knowing whether some process/user has read a file or not.
If your program is the only one reading the file then you can create a dummy file in the same location that is created whenever you start reading it.
This will be useful when your code runs in multiple threads/processes (scanners for a directory) and you do not want a file to be processed more than once.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!