import os
def search(path):
files = os.listdir(path)
for file in files:
f = str(os.path.join(path, file))
# kong
if os.path.isdir(f):
# not kong
if not os.listdir(f):
if(str(f).find('.') == -1):
print(f)
else:
search(f)
if __name__ == '__main__':
path = os.getcwd()
print("work dir:"+path)
print("===================")
search(path)
背景: cocos creator下空文件夾但是有meta文件被提交了,別人拉取就會提示這個meta文件被刪除