I have tidied up your code and removed all the redundant pieces, and it works fine in my tests.
import shutil
import glob
import sys
import os
def find_file(root_folder):
for root,dirs,files in os.walk(root_folder):
for filename in glob.glob(root+"/*.jpg", recursive=True):
if os.stat(filename).st_size > 12000:
print('Image file found:', filename)
source=os.path.join(root,filename)
print('source =', source)
destination = os.path.join(root_folder, "build")
print('destination =', destination)
try:
print('moving ...')
os.makedirs(destination, exist_ok = True)
shutil.move(source,destination)
except OSError as error:
pass
else:
continue
search_path = 'C:\\'
if len(sys.argv) > 1:
search_path = sys.argv[1]
find_file(search_path)