Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

This issue has been added to tracker.
TS

martin wrote:

... Actual file name is "foo.txt" (without space).


True enough, I created a poor example. My apologies. Here's a better (functional!) example:

C:\Temp>copy con "\\?\C:\temp\foo.txt "

blah blah
^Z
        1 file(s) copied.

C:\Temp>dir foo.txt
 Volume in drive C has no label.
 Volume Serial Number is 28BC-75F3

 Directory of C:\Temp

File Not Found

C:\Temp>dir f*
 Volume in drive C has no label.
 Volume Serial Number is BARF-FARB

 Directory of C:\Temp

05/02/2007  11:49 PM                11 foo.txt
               1 File(s)             11 bytes
               0 Dir(s),555,555,555,555 bytes free

C:\Temp>type "\\?\C:\temp\foo.txt "
blah blah

C:\Temp>


You are correct that the Win32 CreateFile() API strips spaces. I think files ending in space may not be "officially supported" by Microsoft, but I'm not sure about that.
martin

TS wrote:

Windows does actually allow spaces at the end of file names. The limitation, as with so many other things, is that the file-ending-in-space has to be created/manipulated through the command prompt, as explorer automatically trims spaces.

This doesn't seem to be true. At least on WinXP. The command line also trim spaces. It trims that both for "copy" and "type", that's why your commands work. Actual file name is "foo.txt" (without space).
TS

Windows does actually allow spaces at the end of file names. The limitation, as with so many other things, is that the file-ending-in-space has to be created/manipulated through the command prompt, as explorer automatically trims spaces.

C:\temp>copy con "foo.txt "

Hello there
^Z
        1 file(s) copied.

C:\temp>type "foo.txt "
Hello there
martin

Pascal wrote:

- replace spaces in dirname by something else,

There can be spaces, but not at the end. WinSCP may trim them. I'll consider that.
Pascal

Hi,

First, thanks for answer and the very good job.
Effectivly, Window$ "rename" directory if it ends with a space.
But, if the remote directory ~ on Linux ~ ends with, the transfert shutdown.
May be it will be possible to avoid this problem?
- replace spaces in dirname by something else,
- (and/or) inform the user
...
martin

Re: Space at end of dirname

On Windows, file or directory cannot end with space.
Pascal

Space at end of dirname

Hi,

When the name of remote directory ends with a space character, the transfert from remote to local make an error "Can't create file 'C:\SpaceDirName \testfile.pdf'.

I'm using WinSCP 3.8.2 (build 330) / SFTP protocole with Norton Commander style.

. 2007-04-24 13:55:34.062 Copying "/xmap/xx xxxxxxx/XMAP /1ETAT1.FRX" to local directory started.
. 2007-04-24 13:55:34.062 Binary transfer mode selected.
* 2007-04-24 13:55:34.062 (ExtException)
. 2007-04-24 13:55:34.062 Asking user:
. 2007-04-24 13:55:34.062 Can't create file 'C:\Documents and Settings\Administrateur\Mes documents\XMAP \1ETAT1.FRX'. ()


This "bug" occurs in WinSCP 4.0 beta.