Cory Posted February 22, 2008 Report Share Posted February 22, 2008 I am writing a macro that renames a network folder which is likely to be locked because a user has a file open. But I don't see an "If Folder Ready" like the "If File Ready". I tried the later with the folder path but it reports that it's not ready in all cases. I had considered recursively looking at each file in the folder to check it any of them were not ready but it's possible that all files are ready and it could still be locked. For instance if someone have an explorer window open to that folder it will cause a lock. Doe anyone know if there's an easy way to determine if the folder is ready? The best way I was able to think of so far was to create a batch file with the rename command and redirect the output to a file which I would read back in and if the file contains "Access is Denied" then I can run with that but this isn't a very elegant solution. The main benefit is that it doesn't error out and I can prompt the user to deal with it and repeat. Quote Link to comment Share on other sites More sharing options...
Cory Posted February 25, 2008 Author Report Share Posted February 25, 2008 Silence can speak a thousand words.... Turns out there is no such functionality. After considering many options in the future I think I will test every file recursively and present the user with a list of locked files and if that results in no matches and the folder doesn't rename wit the normal rename command followed by an If Folder Exist then I know it's an explorer window that's open and I can report that to the users. Quote Link to comment Share on other sites More sharing options...
joe Posted February 25, 2008 Report Share Posted February 25, 2008 Silence can speak a thousand words.... Over the weekend I looked for some functionality in WMI. Nothing. I find it strange. There has to be something or else Windows could not pop up the error message that it does. I'll check out some API calls later. BTW doing a Google was pretty much useless, too. Quote Link to comment Share on other sites More sharing options...
paul Posted February 25, 2008 Report Share Posted February 25, 2008 Yes, I also didn't find anything useful with Google. I have been using Unlocker (it's freeware) for some time, and it apparently includes a command-line facility. You might be able to persuade it to do what you want. Unlocker Quote Link to comment Share on other sites More sharing options...
Cory Posted February 25, 2008 Author Report Share Posted February 25, 2008 Kevin mentioned that he too had looked in their development environment for any such utility and came up empty. Strange isn't it? Anyway I made a feature request with ISS. Unlocker looks interesting but I'm afraid it won't work in this environment as the targets are on an file server and I don't see that it can convince the server OS to give up it's locks. Also I try to avoid another application when I can in a distributed environment. Thanks for all your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.