Topic "Terminate the download path with a slash "/" or not?"

Author Message
[View user's profile]

Joined: 2014-08-13
Posts: 6
Location: Toronto
I used WinSCP to download/upload files from/to a remote server using the SFTP protocol. The client recently switched to Secure FTP as they no longer supports the SFTP protocol. I changed the way I create the Session so I use Protocol.Ftp with all the other settings, such as the FtpMode and the FtpSecure parameters. In SFTP, the remote folder from which I was reading the files had a path that was terminated with a forward slash, something like this "/folder/subfolder/". Once I switched to FTPS, I started getting errors regarding the remote host, something along the lines of "can't get the attributes of file ..." because "file or folder '/folder/subfolder/' does not exist". That was weird. After I played with it for a while, I noticed that in the WinSCP application, once it connects to the remote server, the path is listed without the final forward slash. I changed it in my application as well (so now my remote folder is indicated "/folder/subfolder") and everything works fine.

The interesting thing is that the upload folder is still indicated as "/folder/uploadSubfolder/" and it's still working.

Can anyone confirm that this is the right thing I need to do or is it more to it and I just haven't figured it yet.

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25510
Location: Prague, Czechia
For Session.ListDirectory, the path should not end with a slash.

For Session.PutFiles, the target path should end with a slash, optionally followed with a target file name or an operation mask.

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License