Re: [Tutor] an alternative to shutil.move()?
| Alfonso <[EMAIL PROTECTED]> 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 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] an alternative to shutil.move()?
On Mon, 16 Oct 2006 01:16:19 +0200 Alfonso <[EMAIL PROTECTED]> 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 Michael ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] an alternative to shutil.move()?
Chris Lasher escribió: > How about os.rename > > http://docs.python.org/lib/os-file-dir.html > > On 10/15/06, Alfonso <[EMAIL PROTECTED]> wrote: >> Is there an alternative in python to use shutil.move()? > That's exactly what I was looking for. Thank you very much. Don't know how I didn't find it before. I suppose that I was thinking that the name of the module would be other... __ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] an alternative to shutil.move()?
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... __ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor