tags:

views:

45

answers:

2

We have an app which needs to go through the file system and perform various operations on files (mostly copy).

It's OK if we encounter a file lock

"This process cannot access the file xxx because it is being used by another process"

, because we will just skip it, but the app has to report it to the user. However we want to distinguish between the cases worth reporting such as spreadsheets & documents and uninteresting noise like NTUSER.DAT.

We did think we could just individually specify to skip NTUSER.DAT (or *.DAT) and one or two similar files but it turns out there's dozens of them. Can anyone advise on a rule of thumb to distinguish between files the user would know and understand as files he has opened and the stuff which is just noise.

As examples of "noise" I mean:

  • NTUSER.DAT
  • ntuser.dat.LOG1
  • UsrClass.dat
  • The RecoveryStore in IE
  • parent.lock & sqlite-journal files in Firefox

etc

A: 

Here are some strategies that spring to mind.

  1. You could provide valid extensions
  2. You could provide a list of directories that contains or does not contain valid files -- e.g., c:\windows might contains lots of directories you might want to skip.
  3. You could check which program is holding the lock and specify valid programs

You have to specify inclusion and exclusion predicates somehow. From what I can tell about your problem I would just specify the user's home directory as the directory to include, and perhaps exlude the cache folders.

Hassan Syed
A: 

You might decide not to report locks on hidden or system files (or both).

John Saunders