These are user-supplied utilities. If I like them, they will become part of the distribution. :)


Remove all pages except the system pages

Provided by Engelbert Gruber <>

"""Delete all files not listed.
USAGE: rm-non-systempages SystemPages
  reads SystemPages and cleans curent directory"""
import sys,os
import re

if (len( sys.argv)<=2 ):
        print( __doc__ )

word_match = re.compile("^[ \*]*([^\s]+)")
# Read file list (survivors)
keep = {}
f = open(sys.argv[1])

while 1:
        line = f.readline()
        if not line:
        m = word_match.match(line)      
        if (m and len(>2):
                keep[] = 1

# Scan through directory and remove files not in keep.

for entry in os.listdir(sys.argv[2]):
        # donot test for directories, remove wont do no harm.
        if (not keep.has_key(entry)):
                fn = os.path.join( sys.argv[2], entry )
                print "remove:"+fn
                os.remove( fn )
                print "keep:"+entry

UtilityScripts (last edited 2008-06-26 09:55:23 by anonymous)