I looked into the Python
$ mv ...
>>> source_files = '/PATH/TO/FOLDER/*'
>>> destination_folder = 'PATH/TO/FOLDER'
>>> # equivalent of $ mv source_files destination_folder
Both employ the same syntax:
os.rename("path/to/current/file.foo", "path/to/new/desination/for/file.foo") shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
Note that in both cases the directory in which the new file is being created must already exist, (but, on Windows, a file with that name must not or an exception will be raised). Note also, you must include the file name (
file.foo) in both the source and destination arguments. If it is changed, the file will be renamed as well as moved.
As has been noted in comments on other answers,
shutil.move simply calls
os.rename in most cases. However, if the destination is on a different disk than the source, it will instead copy and then delete the source file.