-
Notifications
You must be signed in to change notification settings - Fork 4
/
sanitizeFiles.py
41 lines (30 loc) · 1.14 KB
/
sanitizeFiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from helper_routines import checkPath
from helper_routines import sanitizeFileNameRemoveExtension
from helper_routines import getNotesFileNames
import sys
import os
notesPath = sys.argv[1]
checkPath(notesPath)
notesFileNames = getNotesFileNames(notesPath)
for noteFileName in notesFileNames:
noteFileName_Sanitized = sanitizeFileNameRemoveExtension(noteFileName)
if noteFileName_Sanitized != noteFileName:
#print(noteFileName + " -> " + noteFileName_Sanitized)
print(noteFileName_Sanitized)
'''
# USE THIS TO CHECK any remaining unexpected chars
if not re.match(r'^[A-Za-z0-9-]+$', noteFileName_Sanitized):
print(noteFileName_Sanitized)
'''
'''
if re.match(r'.*-s-', noteFileName_Sanitized):
print(noteFileName_Sanitized)
if re.match(r'.*-re-', noteFileName_Sanitized):
print(noteFileName_Sanitized)
if re.match(r'.*-ve-', noteFileName_Sanitized):
print(noteFileName_Sanitized)
if re.match(r'.*-ll-', noteFileName_Sanitized):
print(noteFileName_Sanitized)
if re.match(r'.*-t-', noteFileName_Sanitized):
print(noteFileName_Sanitized)
'''