From 5bab89a9f0de270b117b5a42be16294c59e4ccda Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 4 Sep 2025 17:48:38 +0800 Subject: [PATCH] bugfix --- appPublic/folderUtils.py | 68 ++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/appPublic/folderUtils.py b/appPublic/folderUtils.py index 34d10cd..806bd68 100755 --- a/appPublic/folderUtils.py +++ b/appPublic/folderUtils.py @@ -48,22 +48,22 @@ def timestamp2datatiemStr(ts): """ def findAllDrives(): - Drives=[] - # print "Searching for drives..." - drives=win32api.GetLogicalDriveStrings().split(":") - for i in drives: - # print "i=",i,":" - dr=i[-1].lower() - if dr.isalpha(): - dr+=":\\" - inf=None - try: - inf=win32api.GetVolumeInformation(dr) - except: - pass # Removable drive, not ready - # You'll still get the drive letter, but inf will be None - Drives.append([dr,inf]) - return Drives + Drives=[] + # print "Searching for drives..." + drives=win32api.GetLogicalDriveStrings().split(":") + for i in drives: + # print "i=",i,":" + dr=i[-1].lower() + if dr.isalpha(): + dr+=":\\" + inf=None + try: + inf=win32api.GetVolumeInformation(dr) + except: + pass # Removable drive, not ready + # You'll still get the drive letter, but inf will be None + Drives.append([dr,inf]) + return Drives """ ## list all folder name under folder named by path @@ -77,19 +77,19 @@ def listFolder(path, rescursive=False) : yield full_name def listFile(folder,suffixs=[],rescursive=False): - subffixs = [ i.lower() for i in suffixs ] - for f in os.listdir(folder): - p = os.path.join(folder,f) - if rescursive and os.path.isdir(p): - for p1 in listFile(p,suffixs=suffixs,rescursive=True): - yield p1 - if os.path.isfile(p): - e = p.lower() - if suffixs == [] : - yield p - for s in subffixs: - if e.endswith(s): - yield p + subffixs = [ i.lower() for i in suffixs ] + for f in os.listdir(folder): + p = os.path.join(folder,f) + if rescursive and os.path.isdir(p): + for p1 in listFile(p,suffixs=suffixs,rescursive=True): + yield p1 + if os.path.isfile(p): + e = p.lower() + if suffixs == [] : + yield p + for s in subffixs: + if e.endswith(s): + yield p def folderInfo(root,uri=''): relpath = uri @@ -137,11 +137,11 @@ def rmdir_recursive(dir): os.rmdir(dir) def _mkdir(newdir) : - """works the way a good mkdir should :) - - already exists, silently complete - - regular file in the way, raise an exception - - parent directory(ies) does not exist, make them as well - """ + """works the way a good mkdir should :) + - already exists, silently complete + - regular file in the way, raise an exception + - parent directory(ies) does not exist, make them as well + """ return os.makedirs(newdir, exist_ok=True) def _copyfile(fp,dir) :