Unable to delete the folder because it is not empty. The directory is not empty.

During a synchronization, you may receive the following exception:

Exception: Folder delete will continue to be retried, but may never complete.
Unable to delete the folder because it is not empty.
The directory is not empty

Windows does not allow you to delete a folder that is not empty and will return this message. The contents of the folder must be deleted first and then the folder.

If you have any exclusions on your Rule, such as exclusions on the File Masks tab that exclude a file contained within the folder SureSync is attempting to delete, you will receive this message. For example, if you exclude *.tmp and the folder contains a *.tmp folder. There are exclusions on a number of tabs in the Rule, so you would need to review any defined exclusions.

Folder Truncation Deletes

The "allow folder truncation deletes" option will help in some, but not all, cases of this exception. This is a special type of folder deletion that does not consider the folder's contents. It simply deletes the folder and it's contents. This will allow the folder to be deleted if it contains something like an excluded tmp file.

For folder truncation deletes to be used, the following must be true:

  1. The "Skip Temporary Files" and "Skip Hidden and System Files" options must be enabled on the Options tab of the Job.
  2. The Rule cannot contain any additional exclusions in the "This rule applies to the following subfolders" option on the General tab or in the File Masks tab. These must be the defaults of \ and *.*

These restrictions are necessary to prevent unwanted data deletion. For example, if you configure a Rule to exclude -*.docx you would not want a truncation delete performed on a folder that contained .docx files because those files would be deleted.

The "allow truncation deletes" option is enabled by default.

If the exception continues and truncation deletes cannot be used due to the Rule configuration, the folders producing the exception would need to be deleted manually if appropriate.