Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71811
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mnjagadeesh@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'read.': 0.03; 'linux,': 0.07; 'subject:same': 0.07; 'subject:files': 0.09; 'subject:into': 0.09; 'sys,': 0.09; 'windows,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(source': 0.16; 'command,': 0.16; 'dest': 0.16; 'directory)': 0.16; 'format?': 0.16; 'help?': 0.16; 'investigate': 0.16; 'path.': 0.16; 'subject: \n ': 0.16; 'subject:already': 0.16; 'subject:sub': 0.16; 'subject:under': 0.16; 'sure.': 0.16; 'values:': 0.16; 'wrote:': 0.18; 'help.': 0.21; 'import': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'header :User-Agent:1': 0.23; 'directory.': 0.24; 'exists': 0.24; 'mon,': 0.24; 'file.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'source': 0.25; 'skip:" 30': 0.26; 'skip:v 30': 0.26; 'post': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'chris': 0.29; 'code': 0.31; 'file': 0.32; 'lists': 0.32; 'probably': 0.32; 'option': 0.32; 'text': 0.33; 'url:python': 0.33; '(i.e.': 0.33; 'monday,': 0.33; 'plain': 0.33; 'maybe': 0.34; 'subject:from': 0.34; 'could': 0.34; 'subject:with': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'two': 0.37; 'url:library': 0.38; 'files': 0.38; 'pm,': 0.38; 'that,': 0.38; 'does': 0.39; 'either': 0.39; 'how': 0.40; 'read': 0.60; 'commands': 0.60; 'manually': 0.60; 'kindly': 0.61; 'you.': 0.62; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'header:Reply-To:1': 0.67; '20,': 0.68; 'message- id:@localhost.localdomain': 0.74; 'reply-to:addr:gmail.com': 0.80; '2014,': 0.84; 'subject:source': 0.84; 'url:path': 0.84; 'destination': 0.91; 'sheet': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:reply-to:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version:content-type; bh=Vq2JyrH6gdL6jLOM/inbTG/RDnWgfqDl4NjLp1p8snY=; b=sXYFDXfDf7dB4/s/s6snR7gVyW/8FazVA0IxC6UNf7WSD39YeS3/3YGqd2DsIH1lcg 3CPJ34Xq1cqNuGWu8pYmbK+4IJGfZgScDw3JN63PfuutwcqdZcGaXl6AThzjtS4wDGEA 3u1HWnqSxbBeIeGqRz1F9gIgNMw06F0LoL3/Sng+/v98w/Cl8by/QQJcVFQhYZHgX7VT j2are4FYf5Uupq1szcMnGyHiyObuSqmPUBOEeMgV6qvgSskktb1rAA7ppXOLEhqFm6Yd Bf6ZxYdsGnt1xf+/ZlgoQH0ua8buDBh4iI+3h8HVn6AJLLdAMQ82niBdJ8vQzZiU2Sfn fSGw== |
| X-Received | by 10.68.133.229 with SMTP id pf5mr52411835pbb.115.1400601936736; Tue, 20 May 2014 09:05:36 -0700 (PDT) |
| Date | Tue, 20 May 2014 21:35:10 +0530 (IST) |
| From | Jagadeesh Malakannavar <mnjagadeesh@gmail.com> |
| X-X-Sender | njagadeesh@localhost.localdomain |
| To | Satish ML <satishmlwizpro@gmail.com> |
| Subject | Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. |
| In-Reply-To | <45b38d71-bf27-4d8e-b912-1093bbb38dcb@googlegroups.com> |
| References | <e672c890-a0d2-4bf5-bd94-9fdf70b0d1d2@googlegroups.com> <mailman.10123.1400482872.18130.python-list@python.org> <8ff7483f-cec3-4cc8-bedf-68da09571350@googlegroups.com> <89887b39-3988-45cf-9a26-02f3eeef9f22@googlegroups.com> <934ba77e-6794-4d41-a3f3-ca0e370c4afb@googlegroups.com> <575e4180-b222-4e8f-a378-f39a51c3c085@googlegroups.com> <45b38d71-bf27-4d8e-b912-1093bbb38dcb@googlegroups.com> |
| User-Agent | Alpine 2.11 (LRH 23 2013-08-11) |
| MIME-Version | 1.0 |
| Content-Type | MULTIPART/MIXED; BOUNDARY="8323328-427932426-1400601935=:22217" |
| X-Mailman-Approved-At | Tue, 20 May 2014 18:20:43 +0200 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | Jagadeesh Malakannavar <mnjagadeesh@gmail.com> |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10157.1400602844.18130.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1400602844 news.xs4all.nl 2890 [2001:888:2000:d::a6]:56965 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:71811 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi Satish, Can you please send python part in plain text format? Python code here is difficult to read. Thanks On Tue, 20 May 2014, 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 = [] > dest | ination.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) |
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. satishmlwizpro@gmail.com - 2014-05-18 23:53 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Chris Angelico <rosuav@gmail.com> - 2014-05-19 17:01 +1000
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-19 01:08 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-19 02:02 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Rustom Mody <rustompmody@gmail.com> - 2014-05-19 22:57 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-20 05:21 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-20 05:23 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-20 05:24 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-20 05:28 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. alister <alister.nospam.ware@ntlworld.com> - 2014-05-20 12:48 +0000
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Jagadeesh Malakannavar <mnjagadeesh@gmail.com> - 2014-05-20 21:35 +0530
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Rustom Mody <rustompmody@gmail.com> - 2014-05-20 18:29 -0700
Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-21 01:41 -0700
Copying non-existing files, was Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Peter Otten <__peter__@web.de> - 2014-05-21 11:12 +0200
Re: Copying non-existing files, was Re: Copying files from sub folders under source directories into sub folders with same names as source directory sub folders in destination directories without overwriting already existing files of same name. Satish ML <satishmlwizpro@gmail.com> - 2014-05-21 02:34 -0700
Re: Copying non-existing files Peter Otten <__peter__@web.de> - 2014-05-21 12:15 +0200
Re: Copying non-existing files Rustom Mody <rustompmody@gmail.com> - 2014-05-21 07:14 -0700
Re: Copying non-existing files Chris Angelico <rosuav@gmail.com> - 2014-05-22 00:45 +1000
Re: Copying non-existing files Rustom Mody <rustompmody@gmail.com> - 2014-05-21 22:53 -0700
csiph-web