This project is read-only.

Special Characters

Dec 31, 2011 at 4:26 AM

I am trying to do a getfiles from a linux ftp server to a windows box using vb.net. Some of the files have a pipe symbols "|" in the file name. I would like to replace the "|" symbol during the getfiles with some other legal windows character such as a underscore. Is that possible? The "|" causes the getfiles to fail since it isn't a legal windows character.

Jan 2, 2012 at 12:50 PM

Hi Jason,

you can use the following GetFile overload, specifying a local file name without special characters:

public ulong GetFile(string remoteFileName, string localFileName)

I'm thinking about putting a replacement regex pattern in the GetFiles(...) method.

 

Best,

Alessandro Pilotti

[ MVP ASP.Net / IIS ] 

Jan 2, 2012 at 3:46 PM

Last question...

What I'm trying to accomplish is easily done by GetFiles since at the root directory, I download all of the files/folders (many folders deep) maintaining the structure of the path. I guess I could try to look in each folder individually, but am I missing a more simple elegant way to accompish this?

Jan 2, 2012 at 7:13 PM
Edited Jan 2, 2012 at 7:33 PM

I just committed some updated sources to transform all invalid chars for the local filesystem to "_" in the "GetFiles" method.

I'm going to send you a copy of the compiled dll by email.

 

Alessandro

Jan 2, 2012 at 7:14 PM

That's awesome. Thanks so much!

Jan 2, 2012 at 8:14 PM

Not being impatient , but I tried to compile the DLL based on your change set 71686 from today. Even so, I still receive the follow message if there is a "|" symbol in the file name.

System. ArgumentException: Illegal characters in path.

    at System.IO.Path.CheckInvalidPathChars(String Path)

    at System.IO.Path.Combine(String path1, String path2)

    at AlexPilotti.FTPS.CLient.FTPSClient.GetFiles(String remoteDirectoryName, String localDirectoryName, String filePattern, EPatternStyle patternStyle, Boolean recursive, FileTransferCallback transferCallback)

I'm sorry if I'm missing something stupid here......

Jan 2, 2012 at 9:16 PM

Jason,

I just noticed a small error and committed an update to the sources. Can you test now?

Thanks,

Alessandro

Jan 2, 2012 at 9:22 PM

That did it. Thanks again for your help!

Jan 2, 2012 at 9:47 PM

Great! I just discovered that the email I sent you got blocked by my SMTP server because of the contained zipped dll, I'm glad you managed to compile it from the sources.

One note on the semantic of the special characters replacement:

Suppose that you have the following two files on the remote server containing invalid chars on Windows:

  • test|file.txt
  • test<file.txt

both of them will result in:

  • test_file.txt

resulting in the last one overwriting the first one.

In other words there's no name collision check. That's something that I'll add soon (like renaming the second one in test_file1.txt).

 

Best,

Alessandro

 

 

 

 

 

 

Jan 2, 2012 at 9:48 PM
No worries. That should never be a problem for my given application.
Best Regards-
Jason

---------------------------------------
Jason Weintraub
Supervisor, Broadcast Operations
WDIV-TV
(313) 222-0571
jasonw@wdiv.com
---------------------------------------


From: alexp [email removed]
Sent: Monday, January 02, 2012 04:47 PM
To: Jason Weintraub
Subject: Re: Special Characters [ftps:284632]

From: alexp

Great! I just discovered that the email I sent you got blocked by my SMTP server because of the contained zipped dll, I'm glad you managed to compile it from the sources.

One note on the semantic of the special characters replacement:

Suppose that you have the following two files on the remote server containing invalid chars on Windows:

  • test|file.txt
  • test<file.txt

both of them will result in:

  • test_file.txt

resulting in the last one overwriting the first one.

In other words there's no name collision check. That's something that I'll add soon (like renaming the second one in test_file1.txt).

Best,

Alessandro

Jan 2, 2012 at 11:00 PM

I added also the uniqueness check detailed above. The feature is ready for testing and wil be included in the next release.

Best,

Alessandro