python - Deleting Empty Folders In a Directory -


lets says have list of paths lead different folders.

folders = [path1, path2, path3, ......, pathn] 

is there quick way loop through list of folders, , if there nothing inside them delete them? thanks!

just loop through them, calling os.rmdir. work on empty folders, otherwise throws oserror, in case can safely except , ignore via pass.

it easier ask forgiveness permission.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -