Sometimes when I try to rename a folder, I got an error of:
Access is denied.
Make sure the disk is not full or write-protected and that the file is not currently in use.
While I'm sure the files in the folder is not in use by any program or write protected, it's usually solved by restarting Windows.
Is there a way we can check what program/process is actually locking access to the folder renaming?
you can use the
handle tool from sysinternals, something like this:
handle | find /i "C:\path\to\folder"
which ought to give you the process(es) with files in that folder open.
Another option is to use the SysInternals
Process Explorer tool for the same function. The difference is Process Explorer is a GUI app so might be a better solution depending on your skill level.
With process Explorer, first either run it as an admin, or after starting it you can choose File->Show details for All Processes, which will also run it as an administrator. Now you can use the Find->Find Handle or DLL option. Enter the Folder name in the Handle or DLL substring field, and choose search. You'll get a listing of all the processes that have open handles within that folder.
Also I'd like to point out that AV applications are notorious for this type of thing.