Advertisement
Dyrcona

files4mobius.py

Sep 2nd, 2022
1,094
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. from string import Template
  4. from sys import argv
  5.  
  6. PATCHROOT = "~/CWMARS/files/patches/rel_3_7_3/"
  7.  
  8. templ = Template("""[ ! -d ${destdir} ] && mkdir -p ${destdir}
  9. cp ${src} ${dest}""");
  10.  
  11. with open(argv[1], "r") as f:
  12.     while True:
  13.         line = f.readline()
  14.         if not line:
  15.             break
  16.         input = line.strip()
  17.         srcfile = PATCHROOT + input
  18.         destfile = input
  19.         if "templates/opac" in destfile:
  20.             destfile = destfile.replace("templates", "templates_cons")
  21.         destdir = destfile[0:destfile.rfind("/")]
  22.         print(templ.substitute(destdir=destdir,src=srcfile,dest=destfile))
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement