Line | |
---|
1 |
|
---|
2 | import re
|
---|
3 | import sys
|
---|
4 | import fileinput
|
---|
5 | import os
|
---|
6 |
|
---|
7 |
|
---|
8 | path = '/home/andi/HeuristicLab.Mono/'
|
---|
9 |
|
---|
10 |
|
---|
11 | list_files = []
|
---|
12 |
|
---|
13 |
|
---|
14 | def search2(path, extension):
|
---|
15 | for root, dirs, filenames in os.walk(path):
|
---|
16 | for filename in filenames:
|
---|
17 | if os.path.splitext(filename)[-1] == '.csproj':
|
---|
18 | list_files.append(os.path.join(root, filename))
|
---|
19 |
|
---|
20 |
|
---|
21 | extention = '.csproj'
|
---|
22 | search2 (path, extention)
|
---|
23 | print list_files
|
---|
24 |
|
---|
25 |
|
---|
26 | for k in list_files:
|
---|
27 |
|
---|
28 | f = open(k)
|
---|
29 | fout = open (k + "_new", "wt")
|
---|
30 | for line in f:
|
---|
31 | fout.write(line.replace('<PreBuildEvent>', '<PreBuildEvent Condition=" \'$(OS)\' == \'Windows_NT\' ">') )
|
---|
32 | f.close()
|
---|
33 | fout.close()
|
---|
34 | os.system('mv ' + str(k) + '_new' + ' ' + str(k))
|
---|
35 |
|
---|
36 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.