I've got a folder with a load of folders in folders in folders etc... Some of the folders have files, and some do not. I want to cleanup the main folder by finding all directories with no files and deleting them. An example might make more sense:
So if I start with this:
mainFolderfolder1folder1(empty)folder2file.txt
folder3(empty)
folder2folder1(empty)folder2(empty)folder3folder1folder1(empty)
folder3folder1file.txt
I should end up with this:
mainFolderfolder1folder2file.txt
folder3folder1file.txt
So:
/mainFolder/folder1/folder1was deleted cause it had no files/mainFolder/folder1/folder3was deleted cause it had no files/mainFolder/folder2was deleted because cause it had no files, even all the sub-folders were empty
I hope this makes sense...
The only idea I had was to start at mainFolder and recursively travel down each sub-folder deleting the ones that are empty.