Skip to content

Instantly share code, notes, and snippets.

@random-robbie
Created October 8, 2014 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save random-robbie/4cec8056815362550726 to your computer and use it in GitHub Desktop.
Save random-robbie/4cec8056815362550726 to your computer and use it in GitHub Desktop.
Scan all folders and sub-directories and print to output file.
import os, time, glob, fnmatch
maindir = "THE FOLDER YOU WISH TO SCAN"
def scanfolder():
os.chdir(maindir)
for name in glob.glob('*/*.pdf'):
fo = open("Output.txt", "wb")
print name
fo.write(name + "\n")
fo.close()
print "Now scanning for text files"
scanfolder()
time.sleep(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment