1# To move a file in Python, use one of the following:
2import os
3import shutil
4
5os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
6shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
7os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
8
9# In the first two cases the directory in which the new file
10# is being created must already exist.
1import os, shutil
2#move picture.png from /some/dir/ to /another/dir/Pictures/
3shutil.move('/some/dir/picture.png', '/another/dir/Pictures/')
1import os
2import shutil
3
4os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
5os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
6shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
7