Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: Changing directory on the remote FTP site

No slashes are needed in cd command in the FolderName is a subfolder of the home/root folder.

We cannot help you further unless you show us a complete code.

Or start by creating a simple fixed script file and test that, without any VBA. Would it work then? If it does not, show us that script and its session log file.

Changing directory on the remote FTP site

I've got some VBA code that is generating and executing an SFTP script file to transfer files from a client of mine to one of their business partners. The SFTP is working properly, except that the change directory command does not seem to be working properly.

My code looks like:
If ftpRemoteDir <> "" Then

    Script = Script & "# Change the remote directory" & vbCrLf
    Script = Script & "cd " & Quotes(ftpRemoteDir) & vbCrLf
End If
Where the Quotes() function simply wraps the value stored in the variable in double quotes.

And the value of ftpRemoteDir is simply set like:
ftpRemoteDir = "FolderName"

But when I run the script file, it is loading the files into the root folder on the SFTP site. Do I need to include a forward or backwards slash in order to get the destination folder to change properly from the root folder to the correct folder name?