Exception with GetFiles() with Remove on Directory
Here is my set up:
WinSCP 5.7.0.0
Windows 8.1 x64 Enterprise
PowerShell V4
FileZilla FTP Server running locally.
Here is my Code:
$so = New-Object WinSCP.SessionOptions $so.UserName = "MyUser" $so.Password = "MyPassword" $so.HostName = "127.0.0.1" $so.Protocol = "Ftp" $s = New-Object WinSCP.Session $s.Open($so) $s.GetFiles("./TestFolder", "C:\Local\TestFolder", $true)
And it is throwing the following error:
Exception calling "GetFiles" with "3" argument(s): "Operation is not valid due to the current state of the object."
But, it is actually transfering the folder, and removing it from the source. And here is the FileZilla info, with no errors:
(000120)3/20/2015 9:56:29 AM - myuser (127.0.0.1)> PWD
(000120)3/20/2015 9:56:29 AM - myuser (127.0.0.1)> 257 "/" is current directory.
(000120)3/20/2015 9:56:59 AM - myuser (127.0.0.1)> REST 0
(000120)3/20/2015 9:56:59 AM - myuser (127.0.0.1)> 350 Rest supported. Restarting at 0
(000120)3/20/2015 9:57:29 AM - myuser (127.0.0.1)> REST 0
(000120)3/20/2015 9:57:29 AM - myuser (127.0.0.1)> 350 Rest supported. Restarting at 0
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> MLST /TestFolder
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 250-Listing /TestFolder
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> type=dir;modify=20150320135457; /TestFolder
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 250 End
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> CWD /TestFolder/
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 250 CWD successful. "/TestFolder" is current directory.
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> PWD
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 257 "/TestFolder" is current directory.
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> TYPE A
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 200 Type set to A
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> PASV
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,223,251)
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> MLSD
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 150 Opening data channel for directory listing of "/TestFolder"
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 226 Successfully transferred "/TestFolder"
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> CWD /
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 250 CWD successful. "/" is current directory.
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> RMD /TestFolder/
(000120)3/20/2015 9:57:40 AM - myuser (127.0.0.1)> 250 Directory deleted successfully
Thanks for any help.