looking for an extension to my code below, so when the condition is not met files will be moved to "ERROR" folder. Anyone who can help? Thank you :-)
source = '/Users/XY/Desktop/OUT'
destination = '/Users/XY/Desktop/IN'
allfiles = glob.glob(os.path.join(source, '*S*'), recursive=True)
print("Files to move", allfiles)
for file_path in allfiles:
dst_path = os.path.join(destination, os.path.basename(file_path))
shutil.move(file_path, dst_path)
print(f"Moved {file_path} -> {dst_path}")
I tried to search on google but without luck.