Spaces in file names

0 votes
asked Jul 25, 2011 by rspitzer (310 points)
edited Oct 11, 2011

No one may be able to answer this, and it at least to me sounds like an incredibly stupid question, but here goes. My program gets a list of files from a remote ftp site, it saves and sorts this file list. At some later point in the program, it may be necessary to see what files have been added or deleted from the ftp sight from the original list. So the program compares the file names to a stored list, if something is changed then an update occurs. If nothing changes then no update. I use the statement

If Not client.FileExists(file_name) Then okay = False End If

The issue is when a filename has a space in it. Example Test = Test, compares fine for a file name and the program goes merrily along. T est = T est, even though it should compare fine, this always gets flagged and the program thinks something has changed unnecessarily rebuilding my list. Does anyone have any thoughts about this????

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Jul 26, 2011 by Martin Vobr (12,940 points)
edited Jul 26, 2011

It's only a wild guess, but maybe the FTP server is able to properly handle file upload of file with space in filename, but returns incorrect result when checking for file existence.

I would try enclosing filename with " or with '.

If Not client.FileExists("'" + filename + "'") then okay = False End If

You can also try to produce a communication log (as described at http://www.rebex.net/kb/logging.aspx) and see actual commands send and server responses when checking if the file exists. If the problem persists mail the logfile to support@rebex.net for further analysis or update your question and include relevant parts of logfile in it.

...