-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvert.py
27 lines (24 loc) · 824 Bytes
/
convert.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
import os
list1 = []
#os.chdir("OpenFOAM-2.1.x")
n = 0
for dirname, dirnames, filenames in os.walk("OpenFOAM-2.1.x"):#."):
for name in filenames:
if len(name) > 1 and name[-2] == ".":
if name[-1] == "C" or name[-1] == "H":
list1 += [(name, dirname)]
#this assumes elements only differ by one letter
list2 = []
for entry, dir in list1:
for comparison, compDir in list1:
if dir == compDir:
if entry.lower() == comparison.lower():
for i in range(len(entry)):
if(entry[i] != comparison[i]):
if(entry[i] == comparison[i].lower()):
list2 += [(dir, entry, entry + "LC")]
list2 += [(dir, comparison, comparison + "UC")]
else:
list2 += [(dir, comparison, comparison + "LC")]
list2 += [(dir, entry, entry + "UC")]
print len(list2)