copying a file in the python script

Fouff fouff at fouff.com
Tue Apr 5 02:18:02 EDT 2005


Raghul a écrit :
> hi
>    I am having a problem. I want to copy a file from the folder and
> paste it or move it to another folder. Is it possible in python?
> Actually I need to implement this in the zope for my site. When I click
> any file it should move or copied to another folder in the same machine
> using zope.
> 
> Thanks in advance.
> 
Hello.

try this :

import shutil
shutil.copyfile(srcfile, dstfile)

if you want to move, just use this after
import os
os.remove(srcfile)

Bye
Fouff



More information about the Python-list mailing list