Newbie Copy Question

Stacy stacycollings at yahoo.com
Wed Jun 9 20:01:29 EDT 2004


Thanks for the response, Peter!  Another reader helped me out, too,
but I figured out what the problem was...the folders and file names
are case-sensitive!  Once I changed documents and settings...blah blah
blah to Documents and Settings blah blah blah it worked just fine. 
I'm doing some computer migrations at work and I wanted to write a
frozen binary to copy all the important files automatically to my jump
drive for transfer to the new PC.  BTW a jump drive is just a USB
thumb drive that I use to copy stuff from the old computers to the new
:)

Thanks again,

Stacy

Peter Hansen <peter at engcorp.com> wrote in message news:<fbednShX56BA01rdRVn-hg at powergate.ca>...
> Stacy wrote:
> 
> > I'm new to Python (about 2 weeks) and I want to use the shutil module
> > to copy files from Windows XP folders to my jump drive.  My problem is
> > that I can't figure out how to make Python deal with the spaces in
> > Windows folder and file names.  I tried putting the path in quotes
> > (like you do at a DOS prompt) but still no good.  I searched
> > python.org and can't find an answer....any ideas?
> 
> Please post an example of the paths that aren't working.  Spaces
> generally work fine, but perhaps the limitation is with your
> "jump drive" (what's that?) rather than with Python itself.
> Another possibility is that you are using single backslashes
> inside the Python strings, without realizing the effect this
> has when certain characters follow the backslash...  this is
> because of the "escape sequences" allowed in strings to let
> a programmer produce special characters such as TAB (\t) or
> LF (\n).  If that's the case, switching to forward slashes
> should work, or learn to use raw strings as in r'path\file'.
> 
> -Peter



More information about the Python-list mailing list