Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. ## treewalker.py    v0.2
  2.  
  3. import os
  4. from os.path import join, getsize
  5.  
  6. # Set this to where you want the crawler to begin
  7. rootdir="/Users/kermit/Desktop"
  8. # This is where we copy the files
  9. dstdir="/evidence"     
  10. # This is the file we're looking for
  11. targetfile="index"
  12. counter = 0
  13.  
  14. def processFile(fullpath,filename):
  15.     global counter
  16.     if filename == targetfile:
  17.         newname = targetfile + str(counter)
  18.         os.system("echo cp " + fullpath + " " + join(dstdir,newname))
  19.         counter = counter + 1
  20.  
  21. for root, dirs, files in os.walk(rootdir):
  22.     for name in files:
  23.         processFile(join(root, name),name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement