[Tutor] copy/paste/move files

Alex Kleider akleider at sonic.net
Wed May 17 19:11:35 EDT 2017


On 2017-05-17 12:09, Michael C wrote:
> Hi all,
> 
> How do I move files to a designated folder or copy/paste?
> 

The first hit when I googled "how to move a file using python" was
http://stackoverflow.com/questions/8858008/how-to-move-a-file-in-python
which in turn suggests the use of:
os.rename() or shutil.move()
depending on whether you need only to rename or to actually move a file.
(The unix mv utility is used to do both but the 'twofor' is not 
available in Python to my knowledge.)
Don't forget to
import os
or
import shutil
depending on your needs.




More information about the Tutor mailing list