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.
1#all the same
2import os
3import shutil
4
5os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
6os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
7shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")