author | amit@thunder |
Thu, 04 Mar 2010 14:33:38 +0530 | |
changeset 43 | 134b87b382f5 |
parent 41 | e54725be4df6 |
child 44 | d0e9b52bda73 |
permissions | -rw-r--r-- |
40
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
1 |
import glob |
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
2 |
import subprocess |
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
3 |
import re |
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
4 |
import time |
41
e54725be4df6
Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents:
40
diff
changeset
|
5 |
import os |
e54725be4df6
Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents:
40
diff
changeset
|
6 |
import sys |
e54725be4df6
Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents:
40
diff
changeset
|
7 |
repo=sys.argv[1] |
e54725be4df6
Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents:
40
diff
changeset
|
8 |
names= glob.glob(os.path.join(repo,'ch1*.html')) |
40
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
9 |
for name in names: |
41
e54725be4df6
Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents:
40
diff
changeset
|
10 |
reg_obj=re.compile(os.path.join(repo,'ch1[0-9].*.html')) |
40
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
11 |
if (reg_obj.match(name)): |
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
12 |
changed_name=re.sub('ch1','chn1',name) |
43
134b87b382f5
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
amit@thunder
parents:
41
diff
changeset
|
13 |
command2="rm %s" %(name,) |
40
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
14 |
else: |
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
15 |
changed_name=name |
43
134b87b382f5
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
amit@thunder
parents:
41
diff
changeset
|
16 |
command1="cp %s %s" %(name ,changed_name) |
134b87b382f5
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
amit@thunder
parents:
41
diff
changeset
|
17 |
subprocess.Popen(command1,shell=True) |
40
ef147a79b098
Added change names to do required changes in names such that we get the chapter names beyond 10 in proper list
amit@thunder
parents:
diff
changeset
|
18 |
time.sleep(2) |
43
134b87b382f5
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
amit@thunder
parents:
41
diff
changeset
|
19 |
subprocess.Popen(command2,shell=True) |
134b87b382f5
Made changes so that the files so that files above chapter 10 do not come twice also changed the name so that any chapter beyond 9 is listed in the end
amit@thunder
parents:
41
diff
changeset
|
20 |
time.sleep(1) |