On Tuesday, May 20, 2014 11:27:01 AM UTC+5:30, Rustom Mody wrote: > On Monday, May 19, 2014 2:32:36 PM UTC+5:30, Satish ML wrote: > On Monday, > May 19, 2014 12:31:05 PM UTC+5:30, Chris Angelico wrote: > > On Mon, May 19, > 2014 at 4:53 PM, wrote: > Could you kindly help? Sure. Either start writing > code and then post when you have problems, or investigate some shell commands > (xcopy in Windows, cp in Linux, maybe scp) that can probably do the whole > job. Or pay someone to do the job for you. ChrisA > Hi ChrisAngelico, > > Consider that source and destination directories are given in a .xls(excel) > file. > This is the code > import xlrd, sys, subprocess > file_location = > "C:\Users\salingeg\Desktop\input.xls" > workbook = > xlrd.open_workbook(file_location) > sheet = workbook.sheet_by_index(0) > > sheet.cell_value(0, 0) > for row in range(sheet.nrows): > values = [] > > values.append(sheet.cell_value(row, 1)) > destination = [] > > destination.append(sheet.cell_value(row, 2)) > for s in values: > for d in > destination: > If I am using cp or xcopy command, it will copy all files from s to d. > shutil.copy(s, d) can't be used here because it overwrites files in d. Kindly help. have u tried using https://docs.python.org/2/library/os.path.html#os.path.exists ?
I have tried it. But how does it help? We won't be able to make out whether source file is present in destination directory. -- https://mail.python.org/mailman/listinfo/python-list