Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7916
| References | <94a80c85-7a66-4de5-ae35-d4a4b0ea7e37@v8g2000yqb.googlegroups.com> |
|---|---|
| Date | 2011-06-18 13:13 -0400 |
| Subject | Re: How do you copy files from one location to another? |
| From | Michael Hrivnak <mhrivnak@hrivnak.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.126.1308417217.1164.python-list@python.org> (permalink) |
Python is great for automating sysadmin tasks, but perhaps you should just use rsync for this. It comes with the benefit of only copying the changes instead of every file every time. "rsync -a C:\source E:\destination" and you're done. Michael On Fri, Jun 17, 2011 at 1:06 AM, John Salerno <johnjsal@gmail.com> wrote: > Based on what I've read, it seems os.rename is the proper function to > use, but I'm a little confused about the syntax. Basically I just want > to write a simple script that will back up my saved game files when I > run it. So I want it to copy a set of files/directories from a > location on my C:\ drive to another directory on my E:\ drive. I don't > want to rename or delete the originals, just move them. I also want > them to automatically overwrite whatever already happens to be in the > location on the E:\ drive. > > Is os.rename the proper function for this? Mainly I was because the > Module Index says this: > > "On Windows, if dst already exists, OSError will be raised even if it > is a file.." > > so it sounds like I can't move the files to a location where those > file names already exist. > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-16 22:06 -0700
Re: How do you copy files from one location to another? Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-17 01:15 -0500
Re: How do you copy files from one location to another? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-17 19:25 +1200
Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 09:17 -0700
Re: How do you copy files from one location to another? Terry Reedy <tjreedy@udel.edu> - 2011-06-17 15:23 -0400
Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 14:27 -0700
Re: How do you copy files from one location to another? Ethan Furman <ethan@stoneleaf.us> - 2011-06-17 15:15 -0700
Re: How do you copy files from one location to another? John Salerno <johnjsal@gmail.com> - 2011-06-17 16:28 -0700
Re: How do you copy files from one location to another? Tim Golden <mail@timgolden.me.uk> - 2011-06-17 09:04 +0100
Re: How do you copy files from one location to another? Heather Brown <heather@dejaviewphoto.com> - 2011-06-17 12:43 -0400
Re: How do you copy files from one location to another? Michael Hrivnak <mhrivnak@hrivnak.org> - 2011-06-18 13:13 -0400
Re: How do you copy files from one location to another? Terry Reedy <tjreedy@udel.edu> - 2011-06-18 16:52 -0400
csiph-web