-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.py
22 lines (19 loc) · 878 Bytes
/
parser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import subprocess
import os
import os.path as path
# data_path = '/home/igor/Development/med-parsing/Data/'
# for rootpath, dirs, files in os.walk(data_path):
# os.chdir(rootpath)
# for filename in files:
# if filename.endswith('.doc'):
# file_path = path.normpath(path.join(rootpath, filename))
# subprocess.call(['soffice', '--headless', '--convert-to', 'docx', file_path])
# os.remove(file_path)
data_path = '/home/igor/Development/med-parsing/Data/2013 год/'
os.chdir(data_path)
for filename in os.listdir(os.getcwd()):
old_file_path = path.normpath(path.join(data_path, filename))
new_file_path = path.normpath(path.join(data_path, f'13№{filename}'))
os.rename(old_file_path, new_file_path)
# subprocess.call(['soffice', '--headless', '--convert-to', 'docx', file_path])
# os.remove(file_path)