Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
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)

Options

Topic review

DavidK

Re: Error getting name of current remote directory

martin wrote:

It's your server that maps "." path to C:\. It has nothing to do with local configuration of WinSCP or anything, if that's what you mean by .INI file.

Anyway, why don't you use WinSCP .NET assembly?
https://winscp.net/eng/docs/library


The FTP server *is* set to look in another drive. So, perhaps there's some secondary setting that needs attention. Yes, I was referring to the WinSCP .ini file.

I want to use the .net assembly, but since we got the prototype to work, my boss wants to leave the architecture alone. We're stretched a bit for time right now and want to avoid more development hours.

Thanks Martin!
martin

Re: Error getting name of current remote directory

It's your server that maps "." path to C:\. It has nothing to do with local configuration of WinSCP or anything, if that's what you mean by .INI file.

Anyway, why don't you use WinSCP .NET assembly?
https://winscp.net/eng/docs/library
DavidK

Another piece of information is that we had been using the default user folder for the project, then we moved the drop-off to a sub-directory off of D:. I don't understand: if the .ini file has the remote directory setting in D:, why would it try to connect to C:?

Thanks!
David
TriedDavidK

Error getting name of current remote directory

I've seen this error before when trying to login using an interface session where the remote directory has not been set. But now it is set, and I'm seeing this error from an SSIS script task.

Here's the error output:
<?xml version="1.0" encoding="UTF-8"?>
-<session start="2013-04-06T21:50:52.674Z" name="login@ip_address" xmlns="https://winscp.net/schema/session/1.0"> -<failure> <message>Error getting name of current remote directory.</message> <message>Cannot get real path for '.'.</message> <message>Permission denied. Error code: 3 Error message from server (en): The data is invalid. , file: . Request code: 16</message> </failure> </session>

Here's the FTP Server log:
2062 Sft_server_no_virtual_folder_dir, "2062 Sft_server_no_virtual_folder_dir, "C:", Directory name: C:\, "Path 'C:\': is not a direcotory.""

Here's the WinSCP section of the script task:
Process winscp = new Process();

//winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.FileName = Dts.Variables["User::WinSCPcom"].Value.ToString();
winscp.StartInfo.Arguments = "/log=\"" + logname + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine(Dts.Variables["User::WinSCPopen"].Value.ToString());
winscp.StandardInput.WriteLine("lcd " + Dts.Variables["User::DataFolder"].Value.ToString());
winscp.StandardInput.WriteLine("cd " + Dts.Variables["User::RemoteDir"].Value.ToString());
winscp.StandardInput.WriteLine("option transfer binary");
winscp.StandardInput.WriteLine("get " + Dts.Variables["User::SigDeletes"].Value.ToString());
winscp.StandardInput.WriteLine("get " + Dts.Variables["User::SigModules"].Value.ToString());
winscp.StandardInput.WriteLine("close");
winscp.StandardInput.WriteLine("exit");
winscp.StandardInput.Close();


Here is the obfuscated value of the variable WinSCPopen: "open sftp://login:password@IP_address:port". I have confirmed the values by copying and pasting them into the GUI and successfully connecting.

As you can see, I tried adding a CD command before I realized that the error was thrown just after the open command is passed. The server shows a successful connection at first, then it realizes my session is "trying" to visit the C: drive.