-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageFinder.py
More file actions
24 lines (17 loc) · 787 Bytes
/
imageFinder.py
File metadata and controls
24 lines (17 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! python3
# Practice Selective Copy
# imageFinder.py - Copies all the images from a directory and stores them into a new folder
import os
import shutil
def selectiveCopy(folder):
num = 1
folder = os.path.abspath(folder) # make sure folder is absoulte
for foldername, subfolders, filenames in os.walk(folder):
for filename in filenames:
if not filename.endswith('.jpg') or filename.endswith('.JPG'):
continue
#shutil.copy(filename, 'C:\\destination_folder') # Commented out to protect against accidental copying
print(str(num)+'. Copying ' + filename + '...') # Print only to verify if working correctly
num += 1
selectiveCopy(r'source_path')
print('Done')