On Tue, 20 May 2014 05:28:09 -0700, Satish ML wrote: > On Tuesday, May 20, 2014 5:54:47 PM UTC+5:30, Satish ML wrote: >> On Tuesday, May 20, 2014 5:51:19 PM UTC+5:30, Satish ML wrote: > 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. If we can do that, >> like if (source file exists in destination directory) print "exists" >> continue else shutil.copy(s, d) > > Here we don't have the option of manually giving the file path. It has > to be read from .xls file (i.e. from the two lists in code)
1) Post your current code & any errors you are getting, this list is not a free software development house 2) Please clean up your posts before sending so that they are readable either use the mailing list https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single line paragraphs, thanks. Thanks to Mark for the above paragraph I hope this is "Acceptable Usage" & not a copyright breach ;-) -- My weight is perfect for my height -- which varies. -- https://mail.python.org/mailman/listinfo/python-list