-
Notifications
You must be signed in to change notification settings - Fork 6
/
process_wikivoyage.py
56 lines (51 loc) · 1.68 KB
/
process_wikivoyage.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
import os
import glob
import re
import sys
print "starting"
path = './'
for infile in glob.glob( os.path.join(path, '*') ):
print "current file is: " + infile
match = re.search(r'(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)',infile)
match = re.search(r'w\-(\d+)\-wiki',infile)
# match = re.search(r'.+(dddddddddddddd).+',infile)
# match = re.search(r'.+(\dddddddddddddd).+',infile)
if (match) :
print "match %s" % match
print "g1 %s" % match.group(1)
# print "g0 %s" % match.group(0)
ts=match.group(1)
fn="enwikivoyageorg_w-%s-wikidump/enwikivoyageorg_w-%s-history.xml" % (ts, ts)
pn="enwikivoyageorg_w-%s-wikidump*" % (ts)
zn="wtarchive%s*" % (ts)
# cmd = "python ../speedydeletion.py --validate ./%s" % fn
cmd = "python ../wikivoyage_speedydeletion.py ./%s" % fn
print cmd
stat=os.system(cmd)
print stat
if (stat >0) :
sys.exit (stat)
dn="enwikipediaorg_w-%s-wikidump/" % ts
target= "./done/%s" % dn
#if not(os.path.exists(target)):
#cmd = "rm -rf ./%s" % pn
# print cmd
# stat = os.system(cmd)
# print stat
# if (stat >0) :
# sys.exit(stat)
#cmd = "rm -rf ./%s" % zn
#print cmd
#stat = os.system(cmd)
#print stat
#if (stat >0) :
# sys.exit(stat)
#else:
# cmd = "rm -rf ./%s" % dn
# print cmd
# stat = os.system(cmd)
# print stat
# if (stat >0) :
# sys.exit(stat)
else:
print "no match %s" % infile