def findImgFiles(directoryName): print ("> Generating filenames list") nameList = [] for root, dirs, files in os.walk(directoryName): for name in files: if (name.rfind(".png") != -1 or \ name.rfind(".jpg") != -1 or \ name.rfind(".JPEG") != -1 or \ name.rfind(".jpeg") != -1): nameList.append(os.path.join(root, name)) if not nameList: print ("> List of tags is empty!") raise SystemExit return naturalsort(nameList)
def listOfTags(dirName, dotTag): print "> Generating list for " + dotTag + " tags" nameList = [] for root, dirs, files in os.walk(dirName): for name in files: if (name.rfind(dotTag) != -1): nameList.append(os.path.join(root, name)) return naturalsort(nameList)
def generate_clipfile(clipDirName): print "> Generating img list" tag1 = ".png" # nameList = [] for root, dirs, files in os.walk(clipDirName, topdown=False): for name in files: if (name.rfind(tag1) != -1): nameList.append(os.path.join(root, name)) return naturalsort(nameList)
def generate_clipfile(clipDirName): print "> Generating label list" tag1 = ".txt" # nameList = [] for root, dirs, files in os.walk(clipDirName): for name in files: if (name.rfind(tag1) != -1): nameList.append(os.path.join(os.path.basename(root), name)) return naturalsort(nameList)
def findFiles(directoryName, dotTag): #print "> Generating list for " + dotTag + " tags" nameList = [] for root, dirs, files in os.walk(directoryName): for name in files: if (name.rfind(dotTag) != -1): nameList.append(os.path.join(root, name)) if not nameList: print "> List of tags is empty!" raise SystemExit return naturalsort(nameList)