spaces at ends of filenames or directory names on Win32

Tim Roberts timr at probo.com
Sat Feb 25 02:51:25 EST 2006


rtilley <rtilley at vt.edu> wrote:
>
>For example... tell windows to move a file named ' XXX ' (one space 
>before and one space after the filename). Windows will complain that 
>file 'XXX' does not exist. It's correct of course, 'XXX' does not exist, 
>but ' XXX ' does indeed exist.

Are you sure you're doing it right?  It works for me.  Notice that I have
"x.c" and " x.c " in the same directory at the same time.

C:\tmp\x>copy ..\x.c .
        1 file(s) copied.

C:\tmp\x>dir
 Volume in drive C has no label.
 Volume Serial Number is 70CF-E8F4

 Directory of C:\tmp\x

02/24/2006  11:48 PM    <DIR>          .
02/24/2006  11:48 PM    <DIR>          ..
02/22/2006  10:49 PM               539 x.c
               1 File(s)            539 bytes
               2 Dir(s)  50,937,999,360 bytes free

C:\tmp\x>copy x.c " x.c "
        1 file(s) copied.

C:\tmp\x>dir
 Volume in drive C has no label.
 Volume Serial Number is 70CF-E8F4

 Directory of C:\tmp\x

02/24/2006  11:48 PM    <DIR>          .
02/24/2006  11:48 PM    <DIR>          ..
02/22/2006  10:49 PM               539  x.c
02/22/2006  10:49 PM               539 x.c
               2 File(s)          1,078 bytes
               2 Dir(s)  50,937,999,360 bytes free

C:\tmp\x>erase " x.c "

C:\tmp\x>dir
 Volume in drive C has no label.
 Volume Serial Number is 70CF-E8F4

 Directory of C:\tmp\x

02/24/2006  11:49 PM    <DIR>          .
02/24/2006  11:49 PM    <DIR>          ..
02/22/2006  10:49 PM               539 x.c
               1 File(s)            539 bytes
               2 Dir(s)  50,937,999,360 bytes free

C:\tmp\x>
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list