Files
provision_sccp/tftpboot/firmware/mkregex.py
Diederik de Groot 82b5aadc13 Initial check-in
2017-11-13 18:15:58 +01:00

11 lines
365 B
Python
Executable File

#!/usr/bin/env python
from hachoir_regex import parse
from os import listdir,walk,path
from os.path import basename,join,isdir
rootdir = ".";
for subdir in next(walk(rootdir))[1]:
paths = listdir(subdir)
as_regex = [parse(path) for path in paths]
print "^{}$ /firmware/{}/\\1".format(reduce(lambda x, y: x | y, as_regex), basename(subdir))