Advertisement
Guest User

SO Question #7010316

a guest
Aug 11th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. #!/usr/bin/python2.7
  2.  
  3. import os
  4. import glob
  5.  
  6. def process_file(_, path, filelist):
  7.     input_param = " ".join('"' + x + '"' for x in glob.glob(os.path.join(path, "*.pdf")))
  8.     output_param = '"' + os.path.join(path, os.path.basename(path) + ".pdf") + '"'
  9.     cmd = "pdftk " + input_param + " cat output " + output_param
  10.     print cmd
  11.     #os.system(cmd)
  12.  
  13. def files_recursively(topdir):
  14.     os.path.walk(os.path.realpath(topdir), process_file, ())
  15.  
  16. if  __name__ == "__main__":
  17.     files_recursively(os.getcwd())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement