# If you specify the full path to the destination (not just the directory) # then shutil.move will overwrite any existing file: shutil.move(os.path.join(src, filename), os.path.join(dst, filename))
Here is what the above code is Doing:
1. The os.path.join() function is used to join the src and filename strings
into a single path.
2. The shutil.move() function is used to move the file from the src directory
to the dst directory.