I am running some GNU make makefiles via Cygwin, and one of the targets tries to rename a directory:

    @echo "Creating clean local test directories..."
    @if [ -d $(TESTDIR_IN) ]; then mv -f $(TESTDIR_IN) $(TESTDIR_IN)_OLD; fi

This works fine (!) unless I have Windows Explorer open and viewing $(TESTDIR_IN). In that case I get "Permission denied" error, and the make fails.

How do I prevent Windows Explorer from causing such problems? I don't remember it doing this before.

Strange thing is: even after navigating to a completely different directory, but in the same Windows Explorer instance, doesn't help - the only thing that helps is closing Windows Explorer.


Sysinternals/Autorun/Explorer list:


  • You remember incorrectly .A file or directory that is in use cannot be moved. – DavidPostill Oct 5 '20 at 19:54
  • Is it really "in use"? Just viewing it's contents in Windows Explorer. I am pretty sure I never had such problems before. – Danijel Oct 6 '20 at 6:48
  • Explorer has the directory open so you can view the contents – DavidPostill Oct 6 '20 at 6:59
  • I've added some more info to the question. – Danijel Oct 6 '20 at 7:43
  • Have you installed a shell extension lately? Those extensions run inside Windows Explorer and can keep directory handles open. Or is the directory to-be-deleted somehow special (e.g. a git repo) with installed TortoiseGIT shell-ext? – Robert Oct 6 '20 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.