I’m trying to connect to a FTP AS/400 server using .NET, with a url like this:
ftp://server.com/folder/file.csv
I’m getting a 501 error in return, and according to this question it’s due to the path separator or AS/400 not working with regular paths without setting NAMEFMT to 1.
Since I’m using the FTPWebRequest object, is there any way I can set NAMEFMT to 1 with a FTPWebRequest?
You need to send
SITE NAMEFMT 1as aQUOTEcommand.See this related question: How to send arbitrary ftp commands in C#. It doesn’t appear to be possible using
FTPWebRequest.Take a look at libcurl.NET.
Alternatively if you can force
FTPWebRequestto make the ‘first’ file or pathname parameter received in a subcommand start with a slash (/) or a tilde (~) character the system will automatically enforceNAMEFMT 1. See File systems and naming conventions under the FTP reference information topic in the IBM i information center.