I am using WinSCP in a C# program that acts a central processor for multiple FTP servers we send data to. Two of the sites work fine, but with the third I am getting a connection lost error.
The way this company set up their FTP site they only allow a file to be transferred to a specific folder. For example:
root, and
parkseed_000
are read only,
in
has write permissions. I captured both session and debug files for review, but here is the put line
> 2024-05-30 12:34:21.969 Script: put -delete -nopermissions -preservetime -transfer="binary" -- "c:\temp\Marketing\Wiland\PS\PS New Customers_20240530.csv" "/ParkSeedCompany_5919/in"
Note that the remote directory is absolute.
A few lines later this is written in the file:
. 2024-05-30 12:34:21.970 Starting upload of c:\temp\Marketing\Wiland\PS\PS New Customers_20240530.csv
> 2024-05-30 12:34:21.970 CWD /ParkSeedCompany_5919
< 2024-05-30 12:34:22.050 250 Command CWD succeed
> 2024-05-30 12:34:22.050 PWD
< 2024-05-30 12:34:22.112 257 "/ParkSeedCompany_5919" is current directory
> 2024-05-30 12:34:22.112 TYPE I
< 2024-05-30 12:34:22.174 200 Transfer mode set to BINARY
> 2024-05-30 12:34:22.174 PASV
What seems to be happening is that WinSCP is only getting to the parent folder, not the
in
folder and since that is read only, the command fails.
I read in other forums that WinSCP API uses absolute directory paths, but what it looks like internally is that it loops down the path. I did try this using the GUI app to see if I got any other kind of error and I did:
Disconnected from server
Could not retrieve directory listing
Error listing directory '/ParkSeedCompany_5919/in'.
One other path I tried was using a bat file and cmd commands (see file) and I had it switch folders to get to
in
and still could not transfer a file:
PS New Customers_20240530 | 0 B | 0.0 KB/s | binary | 0%
Lost connection.
Disconnected from server
Copying files to remote side failed.
I also tried accessing the site using Filzilla and from their UI I was able to get to that
in
directory and manually move up a file. However I need a programatic way to transfer files. Is there a setting I'm missing or needing that allows the API to move a file.