file-access

File is used by another process. How to know which process?

I keep getting that exception in my program. How do I know which process locked it, either by program code or by doing something with windows? System.IO.IOException : The process cannot access the file 'file.ext' because it is being used by another process. ...

Access to “Program Files” folder needed

I ran into this quite often stated problem but even after looking up nearly every scource I didn’t get an aswer. Problem is as follows: I wrote a little updater tool that connects to a server to check for new versions of an application and then copies the new version to the clientmashine. So the pattern is as follows: Client installs t...

Check if I can write a file to a directory or not with Python.

I need to check if I can write a file to a directory that user point to with Python. Is there an way to check it in advance? I may be using try .. catch for this purpose, but I expect something better in the sense that I can check in advance. ...

Can't delete a service executable after uninstalling it

I'm uninstalling a service like this: using (AssemblyInstaller installer = new AssemblyInstaller(serviceFileName, new String[] { })) { installer.UseNewContext = true; installer.Uninstall(null); } which works fine, but then I try to do a Directory.Delete, and it throws an exception saying that access to the service's executable...