0

I want to know whether is there any function related to file which determines the file is a temporary or log file. since while running Jnotify it becomes tedious since temporary files are created and modified frequently increasing the burden and making jnotify unstable.

So is there anything let me Know asap.

Noel M
  • 15,812
  • 8
  • 39
  • 47
HDK
  • 9
  • 2
  • 2
    Please define "temporary file" and "log file" in the context of JNotify. – Thorbjørn Ravn Andersen Jul 09 '12 at 11:14
  • @ThorbjørnRavnAndersen: I assume that's exactly the problem: there's no reliable way to classify *all* files as one of those. There are actually mission-critical log files and "temporary" files where the application can't actually handle if they are missing. – Joachim Sauer Jul 09 '12 at 11:16
  • There must be a way to filter on certain file types with JNotify: "Don't tell me about these." – duffymo Jul 09 '12 at 11:16
  • @JoachimSauer plenty of potential problems. Here, the question is a bit vague about what is actually _wanted_ and hopefully the clarification will help. – Thorbjørn Ravn Andersen Jul 09 '12 at 11:18
  • Usually you won't look at the whole disk. And if you do, of course you have many notifications but the path is provided so it's easy to filter out .log files and files of your temp directory. – Denys Séguret Jul 09 '12 at 11:18
  • whenever i attach a Jnotify watch id on drive to check out the file modified or deleted or rename unnecessarily it get crowded with temporary or log files making it unstable is just want that if the file is temporary then it Shouldn't execute the function – HDK Jul 09 '12 at 11:18
  • so is there any file related function to distinguish whether a file is temporary or not – HDK Jul 09 '12 at 11:20
  • i tried to use getcontenttype but it returns null – HDK Jul 09 '12 at 11:21

1 Answers1

1

Is there an operating system file attribute that tells you that the file is "temporary"? (You don't specify the operating system.) Without such an attribute, determining that a file is "temporary" by simply examining it (vs using some algorithm based on name/path) will be impossible.

Hot Licks
  • 47,103
  • 17
  • 93
  • 151
  • i want it for windows XP and using the extensions to filter will again cause a problem use of multiple conditions in if statement and some of the files doesn't have any extensions so how could I use if for it – HDK Jul 09 '12 at 11:28
  • @HDK -- Apparently Windows has, in it's "extended attributes" a "temporary" attribute. You *might* be able to get at the extended attributes through one of the java.nio.file.attribute classes. And, once you get there, you *might* discover that the problem application are actually setting the flag. – Hot Licks Jul 09 '12 at 22:48