Текущий код:
Код: Выделить всё
import os
for path, sub_dirs, files in os.walk(root):
for name in files:
# For each file we find, we need to ensure it is a .docx file before adding
# it to our list
if os.path.splitext(os.path.join(path, name))[1] == ".docx":
document_list.append(os.path.join(path, name))
Код: Выделить всё
X:/Serial Numbers/6200\Test Company\6275 Documents\6275rA_Order_TEST_120221.docx
Код: Выделить всё
X:/Serial Numbers/6200\Test Company\6275 Documents\~$75rA_Order_MERZ_120221.docx
Подробнее здесь: https://stackoverflow.com/questions/786 ... -file-name