Google Reviews
If you find this content or our services useful, please leave us a review.


Useful when we want to delete folders which have been left behind after uninstall, but we first need to check that the folder is actually empty!! An example may be a folder named as the vendor (E.g, ‘Adobe’), where other products could also be installed into the same folder (E.g, Acrobat Reader, Acrobat Standard, Creative Suite etc). This script will check if a folder is empty (contains no files and no subfolders) and delete it if so.



Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")

Dim folderToDelete : folderToDelete = "C:\FolderName\"

If objFSO.FolderExists(folderToDelete) Then

	Dim objFolder : Set objFolder = objFSO.GetFolder(folderToDelete)

	If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
	End If

End If

Set objFSO = Nothing


Check if a Folder is Empty (contains no files and no subfolders)
Comments have now been disabled. If you have a question to ask about this post please ask the community!