Archived Forum Post

Index of archived forum posts

Question:

How to handle a filename starts with space (ascii 32) ?

Apr 09 '13 at 10:46

Consider a file names __~1.THU (the underlines represent spaces) When I use CkoFtp2 component to list:

NSLog(@"%@", [ftp GetFileName:[NSNumber numberWithInt:0]]);

The output is ~1.THU

Is there any method to handle this ?


Accepted Answer

The problems likely stem from the fact that FTP is an old protocol and directory information is obtained by parsing directory listings that were originally meant for human viewing. You should examine the contents of the SessionLog property to see what kind of directory listing is being parsed. It's likely a problem that can't be resolved.

I have to add one general comment: It amazes me that anyone would choose to create filenames with leading or trailing SPACE characters. This is just asking for trouble. Why not avoid naming files like this in the first place?