Les
(KiX Master)
2006-02-17 05:04 PM
Test for locked files (in use)

Anyone have a crafty way of testing for files that are in use and therefore locked? I mean besides doing an Open().
Jim came up with a way to exploit a limitation in KiX but Ruud since fixed it.
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=82796&an=0&page=0#82796

I am trying to backup some files with Jooel's MakeCAB() UDF but it kills the script if it encounters a locked file.


Radimus
(KiX Supporter)
2006-02-17 05:31 PM
Re: Test for locked files (in use)

can you copy to a temp dir first?

Les
(KiX Master)
2006-02-17 05:41 PM
Re: Test for locked files (in use)

I thought of that but I have maybe 30 meg of files I need to backup quickly. My logon script does not run sync so the desktop comes up before the script is finished and if the user launches Lotus Notes in the Startup, it can throw locks on the files before my script completes.

Radimus
(KiX Supporter)
2006-02-17 05:46 PM
Re: Test for locked files (in use)

ok... how about moving/renaming the file/folder, backing it up and then restoring it

Les
(KiX Master)
2006-02-17 06:02 PM
Re: Test for locked files (in use)

I can copy the files that have locks on them but cannot MakeCAB() the same files. I'm guessing MakeCAB wants exclusive and cannot get it.
I would rather not copy that much uncompressed data to the DFS because it has FRS replication and I don't want to trigger that much replication.


Les
(KiX Master)
2006-02-17 06:10 PM
Re: Test for locked files (in use)

I suppose I could copy the files locally to %temp% and then MakeCAB from them there and then delete them from temp.

NTDOCAdministrator
(KiX Master)
2006-02-17 09:40 PM
Re: Test for locked files (in use)

You could shell to dos and rename the folder and if you get an error you know it's locked. If not locked it should be able to rename the folder with no problem. Then rename it back to what it was and do your file MakeCAB stuff.

Les
(KiX Master)
2006-02-18 02:55 PM
Re: Test for locked files (in use)

Sorry doc, that would not do. It would pull the rug out from under the client and really mess things up.
I gave up on the notion of testing locks and decided to copy the files (in use or not) to another local folder and then MakeCAB from those. I then delete the copies. Solves a whole bunch of problems that way.
Still, there may be value in finding a way to easily test if there are files in use for other purposes.