-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheckEachAssetDirectoryForOneNoteOnly.py
86 lines (70 loc) · 2.89 KB
/
checkEachAssetDirectoryForOneNoteOnly.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# coding=utf-8
from helper_routines import checkPath
from helper_routines import getNotesFileNames
from helper_routines import getAttachmentsDirectoryNames
from helper_routines import bearEscapeDirectoryName
import sys
import codecs
#import urllib
notesPath = sys.argv[1]
checkPath(notesPath)
notesFileNames = getNotesFileNames(notesPath)
attachmentsDirectoryNames = getAttachmentsDirectoryNames(notesPath)
counter = 1
for eachDirectory in attachmentsDirectoryNames:
#if counter < 1795:
# counter = counter + 1
# continue
#if eachDirectory.find("MOONGIFT") != -1:
# counter = counter + 1
# continue
originalDirectoryName = eachDirectory
# directoryAsFoundInMd = unicode("))
eachDirectory = bearEscapeDirectoryName(eachDirectory)
directoryAsFoundInMd = unicode("
noteFilePath = notesPath + "/" + originalDirectoryName + ".md"
try:
with codecs.open(noteFilePath, 'r', encoding='utf-8') as file:
data = file.read()
file.close()
if data.find(unicode("![")) == -1:
print("")
print(directoryAsFoundInMd)
print("counter: " + str(counter))
print("####### the file " + noteFilePath +" exists but does not contain ANY link")
elif data.find(directoryAsFoundInMd) == -1:
print(directoryAsFoundInMd)
print("counter: " + str(counter))
print("####### the file " + noteFilePath +" exists - some escaping is wrong")
except:
print("")
#print(directoryAsFoundInMd)
#print("counter: " + str(counter))
#print("####### the file " + noteFilePath +" does not exist")
"""
howManyFilesPointToDir = 0
for noteFileName in notesFileNames:
with codecs.open(noteFileName, encoding='utf-8') as file:
data = file.read()
file.close()
if data.find(directoryAsFoundInMd) != -1:
howManyFilesPointToDir = howManyFilesPointToDir + 1
else:
if howManyFilesPointToDir > 0:
break
if howManyFilesPointToDir == 0:
noteFilePath = notesPath + "/" + originalDirectoryName + ".md"
print(directoryAsFoundInMd)
print("counter: " + str(counter) + " " + noteFileName)
try:
with codecs.open(noteFilePath, encoding='utf-8') as file:
data = file.read()
file.close()
if data.find(unicode("![")) == -1:
print("####### the file " + noteFilePath +" exists but does not contain ANY link")
else:
print("####### the file " + noteFilePath +" exists - some escaping is wrong")
except:
print("####### the file " + noteFilePath +" does not exist")
"""
counter = counter + 1