-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchangeslash.py
More file actions
29 lines (25 loc) · 782 Bytes
/
changeslash.py
File metadata and controls
29 lines (25 loc) · 782 Bytes
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
import os
import sys
import string
fileList = []
rootdir = os.getcwd()
for root, subFolders, files in os.walk(rootdir):
for file in files:
fn=os.path.join(root,file)
#print fn
filename,filext=os.path.splitext(file)
#print filename,filext
if filext=='.cpp' or filext=='.h' or filext=='.c':
print fn
f=open(fn)
ft=fn+'.bak'
fb=open(ft,'w')
for fl in f.readlines():
if fl.find("#include")!=-1:
fl=fl.replace('\\','/')
#print fl
fb.write(fl)
f.close()
os.remove(fn)
fb.close()
os.rename(os.path.join(root,ft),fn)