import books from import folder, fixes #136
This commit is contained in:
parent
1cd6f35b86
commit
75fd720b19
4 changed files with 32 additions and 11 deletions
|
|
@ -310,14 +310,15 @@ def update_dict(root, data):
|
|||
if hasattr(root, '_save'):
|
||||
root._save()
|
||||
|
||||
def remove_empty_folders(prefix):
|
||||
def remove_empty_folders(prefix, keep_root=False):
|
||||
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)
|
||||
if root != prefix or not keep_root:
|
||||
empty.append(root)
|
||||
for folder in empty:
|
||||
remove_empty_tree(folder)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue