示例#1
0
文件: util.py 项目: hsoft/musicguru
def clean_empty_dirs(path, deleteself=False, files_to_delete=[]):
    """Recursively delete empty dirs in directory. 'directory' is deleted only
    if empty and 'deleteself' is True.
    Returns the list of delete paths.
    files_to_delete: The name is clear enough. However, files in
        this list will ONLY be deleted if it makes the directory deletable
        thereafter (In other words, if the directory contains files not in the
        list, NO file will be deleted)
    """
    result = []
    subdirs = [name for name in io.listdir(path) if io.isdir(path + name)]
    for subdir in subdirs:
        result.extend(clean_empty_dirs(path + subdir, True, files_to_delete))
    if deleteself and delete_if_empty(path, files_to_delete):
        result.append(str(path))
    return result
示例#2
0
文件: app.py 项目: qingsing/dupeguru
 def clean_empty_dirs(self, path):
     if self.options['clean_empty_dirs']:
         while delete_if_empty(path, ['.DS_Store']):
             path = path[:-1]
示例#3
0
文件: app.py 项目: zoodis/dupeguru
 def clean_empty_dirs(self, path):
     if self.options["clean_empty_dirs"]:
         while delete_if_empty(path, [".DS_Store"]):
             path = path.parent()
示例#4
0
文件: app.py 项目: smisra100/dupeguru
 def clean_empty_dirs(self, path):
     if self.options["clean_empty_dirs"]:
         while delete_if_empty(path, [".DS_Store"]):
             path = path.parent()
示例#5
0
 def clean_empty_dirs(self, path):
     if self.options['clean_empty_dirs']:
         while delete_if_empty(path, ['.DS_Store']):
             path = path.parent()