[OT] Win32 and forward/backslashes (was "The format of filename")
python.list at tim.thechases.com
Thu Oct 26 19:37:37 CEST 2006
Tim Roberts wrote:
>> C:\temp\foo\bar>cd ..
>> C:\temp\foo>cd ..
>> C:\temp>cd /foo/bar
> This one does not work for me, but as long as the initial slash is back,
> the rest can be foreward:
> C:\tmp>cd /foo/bar
> The system cannot find the path specified.
> C:\tmp>cd \foo/bar
> What OS are you running? Do you have the shell extensions enabled? The
> latest cd does take a parameter (/d), so I wouldn't expect it to work.
This is cmd.exe on XP (SP2) with shell extensions enabled.
Note the subtle difference though...your "foo" is in the root
directory...mine is in the current directory. My result of
>> C:\temp>cmd < foo/bar/pip
>> [directory listing within a subshell]
> I'm also surprised by this one. I'll file this away for my next NT
> trivia contest...
You're a sick, sick fellow. :) I just stumbled across it while
trying various shot-in-the-dark permutations of command calls
with f-slashes and b-slashes in paths.
>> C:\temp>cmd < /foo/bar/pip
>> The system cannot find the path specified.
C:\temp>cmd < /temp/foo/bar/pip
fails as well. In more misadventures:
C:\temp>echo dir > zip
C:\temp>move zip foo/bar
C:\temp>dir /b foo\bar
C:\temp>move foo/bar/zip .
The system cannot find the path specified.
Okay...MOVE likes it as a destination, but not as a source.
Aaaggghh...If I had any hair, I'd be pulling it out. Move and
copy are similar options. Let's try copy:
C:\temp>move foo\bar\zip .
C:\temp>copy zip foo/bar
1 file(s) copied.
C:\temp>copy foo/bar/zip .
100% copied 1 file(s) copied.
<sarcasm>Of course! MOVE only accepts forward slashes in
destinations, not the source. But COPY accepts either.</sarcasm>
There's no "zip" in the "baz" directory, so let's copy it there:
C:\temp>copy foo/bar/zip foo/baz
Overwrite foo\zip? (Yes/No/All): y
The file cannot be copied onto itself.
0 file(s) copied.
What the [expletive]!? Well, there's a "zip" in our temp
directory, but no "pip". How about we try copying "pip" to the
"baz" directory instead while keeping the same syntax as above?
C:\temp>copy foo/bar/pip foo/baz
The syntax of the command is incorrect.
Some OS programmer doesn't seem to have graduated from their
More information about the Python-list