Easy way to lock a file on a remote machine (windows)?

Posted by roufamatic on Stack Overflow See other posts from Stack Overflow or by roufamatic
Published on 2010-06-08T00:02:49Z Indexed on 2010/06/08 0:22 UTC
Read the original article Hit count: 247

Filed under:
|
|

I've tracked down an error in my logs, and am trying to reproduce it. My theory is that a file sometimes gets locked in a specific folder, and when the application (ASP.NET) tries to delete that folder it hangs.

I don't have the application running on my own machine so I'm debugging this on a remote server. But for the life of me, I can't seem to figure out a way to lock a file that prevents it from being deleted by the process.

My first thought was to map the network path to a local drive and just leave a command prompt open to that folder. Locally that always fouls up my folder deletes, but apparently SMB is a bit more robust and doesn't grant me a lock.

After that I created an infinte loop vbscript in the folder and executed it remotely. The file was deleted out from underneath the executing code. Man!

I then tried creating a file on the server in that folder and removing all permissions. That didn't do the trick. I don't have access to the IIS settings so perhaps it's running under a privileged system account.

So: what's a program that you know is free and I can quickly use to create an exclusive lock on a file so I can test my delete theory? Like a really, really bad Notepad clone or something.

:-)

© Stack Overflow or respective owner

Related posts about Windows

Related posts about application