Using .Net to rename file

Advertisement

mikedovell
Joined:
Posts:
5
Location:
USA

Using .Net to rename file

I am having an issue renaming the files that I transfer. The exact error that I receive is "Element "call" not found in the log file.

I am calling session.executecommand(mv fileuploaded newfilename);

Any help would be much apprecitated.

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Using .Net to rename file

I was not able to reproduce the problem. For me session.ExecuteCommand("mv ... ...") works.

Reply with quote

Vara04
Joined:
Posts:
5
Location:
France

Same pb:
I've got
'MV': command not understood.

I try with mv, MV, rename with the same result

2012-05-26 11:46:18Z] [0001] CallstackAndLock..ctor entering
[2012-05-26 11:46:18Z] [0001]   Command: [call MV /TestFTP/AACC.CSV /TestFTP/OUT/AACC.CSV]
[2012-05-26 11:46:18Z] [0001]   ExeSessionProcess.ExecuteCommand entering
[2012-05-26 11:46:18Z] [0003]       Scheduling output: [winscp> call MV /TestFTP/AACC.CSV /TestFTP/OUT/AACC.CSV]
[2012-05-26 11:46:18Z] [0003]     ExeSessionProcess.ProcessInputEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0001]   ExeSessionProcess.ExecuteCommand leaving
[2012-05-26 11:46:18Z] [0001]   Output: [winscp> call MV /TestFTP/AACC.CSV /TestFTP/OUT/AACC.CSV]
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]     Scheduling output: [500 'MV': command not understood.]
[2012-05-26 11:46:18Z] [0001]   Output: [500 'MV': command not understood.]
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]     Scheduling output: ['MV': command not understood.]
[2012-05-26 11:46:18Z] [0001]   Output: ['MV': command not understood.]
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]     Scheduling output: []
[2012-05-26 11:46:18Z] [0001]   Output: []
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent leaving
[2012-05-26 11:46:18Z] [0003]   ExeSessionProcess.ProcessEvent entering
[2012-05-26 11:46:18Z] [0003]     ExeSessionProcess.ProcessInputEvent entering
[2012-05-26 11:46:18Z] [0001]   Exception: WinSCP.SessionRemoteException: 'MV': command not understood.
[2012-05-26 11:46:18Z] [0001]   Failed: [WinSCP.SessionRemoteException: 'MV': command not understood.]
[2012-05-26 11:46:18Z] [0001] CallstackAndLock..ctor leaving

Any idea ?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Vara04 wrote:

Same pb:
I've got
'MV': command not understood.
With FTP protocol this should do:
session.ExecuteCommand("RNFR ...")
session.ExecuteCommand("RNTO ...")

Though I cannot test it atm.

Reply with quote

Advertisement

mikedovell
Joined:
Posts:
5
Location:
USA

Re: Using .Net to rename file

martin wrote:

Please set Session.DebugLogPath and post the log.

I get an error that access to the path is denied and I am local admin on this machine. I have tried multiple paths with the same result.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Using .Net to rename file

mikedovell wrote:

martin wrote:

Please set Session.DebugLogPath and post the log.

I get an error that access to the path is denied and I am local admin on this machine. I have tried multiple paths with the same result.
Can you be more specific please? Like posting the exception, including callstack. Also, how do you run the .NET code?

Reply with quote

mikedovell
Joined:
Posts:
5
Location:
USA

Re: Using .Net to rename file

martin wrote:

mikedovell wrote:

martin wrote:

Please set Session.DebugLogPath and post the log.

I get an error that access to the path is denied and I am local admin on this machine. I have tried multiple paths with the same result.
Can you be more specific please? Like posting the exception, including callstack. Also, how do you run the .NET code?

session.SessionLogPath = "C:\logs" - Throws the exception "141"
session.SessionDebugPath = "C:\logs" - Throws the exception "Access to the path 'C:\logs' is denied."

It doesn't mater which directory that I point those two properties to, I always get those two exceptions. If I use the path ending with a backslash Eg - C:\Logs\ I get an exception that the property is not in the correct format.

Thanks,

Mike

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Using .Net to rename file

mikedovell wrote:

session.SessionLogPath = "C:\logs" - Throws the exception "141"
session.SessionDebugPath = "C:\logs" - Throws the exception "Access to the path 'C:\logs' is denied."

It doesn't mater which directory that I point those two properties to, I always get those two exceptions. If I use the path ending with a backslash Eg - C:\Logs\ I get an exception that the property is not in the correct format.
It should be path to file (e.g. "c:\logs\session.log"), not path to directory.

Reply with quote

mikedovell
Joined:
Posts:
5
Location:
USA

Re: Using .Net to rename file

Here is the debug log from the Call to rename the file. What's strange from the output is that when I just upload a file to the server it uses my public key and once I rename the public key section is empty. Perhaps this is why the server is refusing the command to rename?

[2012-06-04 09:55:07Z] [000a] Scheduling output: [winscp> call rename /incoming/sftptestfile3.tmp /incoming/sftptestfile3.txt]
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessInputEvent leaving
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:07Z] [000a] Scheduling output: [Searching for host...]
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:07Z] [0009] Output: [winscp> call rename /incoming/sftptestfile3.tmp /incoming/sftptestfile3.txt]
[2012-06-04 09:55:07Z] [0009] Output: [Searching for host...]
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:07Z] [000a] Scheduling output: [Connecting to host...]
[2012-06-04 09:55:07Z] [0009] Output: [Connecting to host...]
[2012-06-04 09:55:07Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:08Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:08Z] [000a] Scheduling output: [Authenticating...]
[2012-06-04 09:55:08Z] [0009] Output: [Authenticating...]
[2012-06-04 09:55:08Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:08Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:08Z] [000a] Scheduling output: [Using username "REMOVED".]
[2012-06-04 09:55:08Z] [0009] Output: [Using username "REMOVED".]
[2012-06-04 09:55:08Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Authenticating with public key "".]
[2012-06-04 09:55:09Z] [0009] Output: [Authenticating with public key "".]
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Server refused to start a shell/command]
[2012-06-04 09:55:09Z] [0009] Output: [Server refused to start a shell/command]
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Authentication log (see session log for details):]
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Using username "REMOVED".]
[2012-06-04 09:55:09Z] [0009] Output: [Authentication log (see session log for details):]
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Authenticating with public key "".]
[2012-06-04 09:55:09Z] [0009] Output: [Using username "REMOVED".]
[2012-06-04 09:55:09Z] [000a] Scheduling output: [
]
[2012-06-04 09:55:09Z] [0009] Output: [Authenticating with public key "".]
[2012-06-04 09:55:09Z] [000a] Scheduling output: [Authentication failed.]
[2012-06-04 09:55:09Z] [0009] Output: [
]
[2012-06-04 09:55:09Z] [0009] Output: [Authentication failed.]
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent entering
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessInputEvent entering
[2012-06-04 09:55:09Z] [0009] Exception: WinSCP.SessionLocalException: Element "call" not found in the log file
[2012-06-04 09:55:09Z] [0009] CallstackAndLock..ctor leaving
[2012-06-04 09:55:09Z] [0009] CallstackAndLock..ctor entering
[2012-06-04 09:55:09Z] [0009] Session.DoDispose entering
[2012-06-04 09:55:09Z] [0009] Session.Cleanup entering
[2012-06-04 09:55:09Z] [0009] Command: [exit]
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.ExecuteCommand entering
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.ExecuteCommand leaving
[2012-06-04 09:55:09Z] [000a] Scheduling output: [winscp> exit]
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessInputEvent leaving
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvent leaving
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.Close entering
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.Close leaving
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.Dispose entering
[2012-06-04 09:55:09Z] [000a] ExeSessionProcess.ProcessEvents leaving
[2012-06-04 09:55:09Z] [0009] ExeSessionProcess.Dispose leaving
[2012-06-04 09:55:09Z] [0009] Session.Cleanup leaving

Reply with quote

Advertisement

martin
Site Admin
martin avatar

Re: Using .Net to rename file

There's no date set yet.

Anyway, please set Session.SessonLogPath and post or email me the log. I want to investigate why the key is empty when renaming the file.

Reply with quote

Advertisement

You can post new topics in this forum