[Tutor] an alternative to shutil.move()?

Michael Lange klappnase at freenet.de
Mon Oct 16 13:00:47 CEST 2006

On Mon, 16 Oct 2006 01:16:19 +0200
Alfonso <euoar at yahoo.es> wrote:

> Is there an alternative in python to use shutil.move()?
> It copies the files and then removes the source file insted of just 
> moving directly the file (don't know much about file systems, but I 
> suppose that when you move using the shell, if both source and 
> destination are in the same partition, it's just a matter of changing 
> the entries in the file allocation table). Copying the entire file, 
> specially with big files is very slow, and I think that it makes an 
> unnecesary use of the hard drive and system resources, when both source 
> file and destination are on the same partition...

Try os.rename(old, new)

I hope this helps


More information about the Tutor mailing list