import os
def move_files(src_dir, dst_dir):
files = os.listdir(src_dir)
for file in files:
if file.endswith(".jpg"):
src_file = os.path.join(src_dir, file)
dst_file = os.path.join(dst_dir, file)
os.rename(src_file, dst_file)
src_dir = "/path/to/source/directory"
dst_dir = "/path/to/destination/directory"
move_files(src_dir, dst_dir)
网友评论