Not tested but should be close:

import os
import shutil

files = ['file1.txt']
source_directory      = '/tmp/source/'
destination_directory = '/tmp/destination/'

for file in files:
    src=os.path.join(source_directory, file
    dst=os.path.join(destination_directory, file
    if os.path.exists(os.path.join(source_directory, file):
        shutil.copy(src, dst)

-Larry Bates

[EMAIL PROTECTED] wrote:
> can anyone help me with this...
> 
> I want to search for a list for files in a given directory and if it
> exists copy them to destination directory
> 
> so what i am looking for is :
> 
> file = 'file1.txt'
> source_directory      = '/tmp/source/'
> destination_directory = '/tmp/destination/'
> 
> so If the file exists in source_directory cp that file to the
> destination_directory..
> 
> hope I am clear
> 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to