remove .DS_Store if its the only file left

This commit is contained in:
j 2016-01-16 12:14:54 +05:30
parent 5110410eda
commit 6692e9f3a8
1 changed files with 3 additions and 0 deletions

View File

@ -315,6 +315,9 @@ def update_dict(root, data):
def remove_empty_folders(prefix):
empty = []
for root, folders, files in os.walk(prefix):
if len(files) == 1 and files[0] == '.DS_Store':
os.unlink(os.path.join(root, files[0]))
files = []
if not folders and not files:
empty.append(root)
for folder in empty: