Archive: Only delete dir, if empty


Only delete dir, if empty
What is the best way to check, whether a directory and all its subdirectories are empty in order to delete the directory?

Image, you install an application. The uninstaller should only delete the directory, into which the application was installed, if the user never saved userdefined files in the application directory.


Just RMDir "dirpath" on every upper level directory down to the lowest level directory.
Without the /r switch, RMDir will not delete the folder unless it is empty.

-Stu