Skip to content

Instantly share code, notes, and snippets.

@paxti
Created February 12, 2016 16:35
Show Gist options
  • Save paxti/4b7d29bc2364130b1b9d to your computer and use it in GitHub Desktop.
Save paxti/4b7d29bc2364130b1b9d to your computer and use it in GitHub Desktop.
Recursive search and copy
import glob
from shutil import copyfile
import shutil
import os
i=0
search_template = 'C:/**/*ert*.jpg'
copy_to = 'C:/Pintrest/'
for filename in glob.iglob(search_template, recursive=True):
print(filename)
shutil.copyfile(filename, copy_to + str(i) + '__' + os.path.basename(filename))
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment