2018年5月16日星期三

删除Mac文件夹中DS_S文件

import os, sys;

def walk(path):
    print("cd directory:"+path)
   
    for item in os.listdir(path):
        if(item == '.DS_Store'):
            global count
            count = count+1
            print("find file .Ds_Store")
            os.remove(path + '/' +item)
        else:
            if(os.path.isdir(path + '/' + item)):
                print(" " + path  + item + "  "+"is directory")
                walk(path + '/' + item)
            else:
                print(" " + path + item + "is file")



if __name__=='__main__':
    count = 0
#    dir = '/Users/sisyphus/darkflow/VOCtest2018/testJPEG/'
    dir = "/Users/sisyphus/darkflow/VOCtest2018/JPEGImages270AugCon"
#    dir = "/Users/sisyphus/darkflow/VOCtest2018/Annotations270AugCon"
#    dir = "/Users/sisyphus/SSD-Tensorflow/VOCtest2018/Annotations270Enh"
#    dir = "/Users/sisyphus/darkflow/VOCtest2018/AnnotationTrainAugEnh"
#    dir = "/Users/sisyphus/Fromhuanxian/NEU-DET 2/IMG_2"
   
    walk(dir)
    print("\ntotal number:" + str(count))

没有评论:

发表评论

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...