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

Tim Golden tim.golden at viacom-outdoor.co.uk
Mon Oct 16 14:05:34 CEST 2006


| 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...

I'm assuming that you're on Win32 because of the "shell" and 
"file allocation table" references. If so, try the stuff in
the pywin32 package:

http://timgolden.me.uk/python/win32_how_do_i/copy-a-file.html#shell

(Obviously, substitute move for copy as appropriate)

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Tutor mailing list