[Pythonmac-SIG] Moving files

Erik van Blokland erik@letterror.com
Mon, 28 Feb 2000 15:19:03 +0100


-- JoanCarles p Casas=EDn [2/28/00 1:27 PM]:

>>Hi,
>>
>>is there a function available in Python to move a file
>>from one directory to another?
>
>import findertools
>
>findertools.move(file_or_folder, destination_folder)

this one is faster:

import os
srcpath =3D 'the:old:location.txt'        # fill in your paths here!
dstpath =3D 'the:new:location.txt'
os.renames(srcpath, dstpath)

findertools instructs the Finder via appleevents to move the files. When 
you're moving a lot the AE mechanims gets clogged and cause the Finder 
the protest/crash. os.renames just changes the directory directly.



erik van blokland

-- letterror