I am watching a directory recursively using QFileSystemWatcher. And I am not able to rename/delete the parent directory either programmatically or manually if its sub directories are being watched.

When trying to rename manually through system i get a message box saying "The action cannot be completed because the folder/ file in it is opened in another program" and on renaming programmatically it fails.

I got these similar bugs, but no resolution:



I am not watching . and .. as said in the above link, but still the directory is locked.

In case of programmatically renaming.. I tried a workaround:
1. Remove all the subdirectory paths from watcher before renaming the parent.
2. Rename parent.
3. Add subdirectory paths again.

But here too my program fails on first step. QFileSystemWatcher::removePath() returns false when trying to remove the subdirectory, and QFileSystemWatcher::directories() show that directory in the paths being watched. Same as posted here https://bugreports.qt-project.org/browse/QTBUG-10846

Since step 1 fails here, step 2 also fails and i cannot rename the parent dir.

I am using Qt5.2.1 and Windows 7.

Kindly help me with a resolution.