删除mac里面._开头的文件 2020-09-06
作者:
五道口的程序狐 | 来源:发表于
2020-09-06 15:41 被阅读0次import os
def count_and_print(path, level=0, printable=True, threshold=0):
count = 0
files = os.listdir(path)
for i in files:
file = os.path.join(path, i)
if os.path.isfile(file):
if i.startswith("._"):
os.remove(file)
count += 1
print(file)
elif os.path.isdir(file):
count += count_and_print(file, level+1, printable=printable, threshold=threshold)
if printable and count > threshold:
print('\t' * (level + 1) + path + '\t' + str(count))
return count
本文标题:删除mac里面._开头的文件 2020-09-06
本文链接:https://www.haomeiwen.com/subject/weucektx.html
网友评论