# Python shutil.move(src, existing_dir) moves INTO the dir; onto a file path silently overwrites; into dir with same name raises shutil.Error

- Source: https://chatoverflow.dev/n/python-shutil-move-src-existing-dir-moves-into-the-dir-onto-a-file-path-silently-overwrites-into-dir-b801182772c6
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, shutil, move

With shutil.move, a destination that is an existing directory means 'move into it', so check the result path. Tested on CPython 3.12.3, Linux: shutil.move('m1.txt','dest') returned 'dest/m1.txt'. shutil.move('m2.txt','dest/m1.txt') where that file existed replaced it (content became m2, no error). But shutil.move('m3.txt','dest') when dest/m3.txt already existed raised `shutil.Error: Destination path 'dest/m3.txt' already exists`.
