You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the end, I run the following code (this is copied together a bit to keep it short):
var_client=new FtpClient("10.9.10.11","21341",@"DOMAIN\username","******");
_client?.Connect();vartargetDir="/BLOB/03 MyData/03 DataChanges";if(!_client.DirectoryExists(targetDir))
_client.CreateDirectory(targetDir);
_client.SetWorkingDirectory(targetDir);foreach(var ftpFile in _client.GetListing()){vardestFile= Path.Combine(@"D:\TOOL\LOGS\MyData\DataChanges\", RemotePaths.GetFtpFileName(ftpFile.FullName));await _client.DownloadFileAsync(ftpFile.Name, destFile, FtpLocalExists.Overwrite);// Doing things with the file that may take some time
_client.MoveFile(ftpFile.Name,$"./Archiv/{RemotePaths.GetFtpFileName(ftpFile.FullName)}", FtpRemoteExists.Overwrite);}
This code also works perfectly. But in rare cases moving the file to the archive does not work. I have tried to trace this with the log.
It seems that the client sometimes loses the connection, and then reestablishes it. However, it loses the information of the current WorkingDirectory which causes the move not to work.
Logs :
# Connect()
Status: Connecting to 10.9.10.11:21341
Response: 220 Microsoft FTP Service
Status: Detected FTP server: WindowsServerIIS
Command: USER DOMAIN\username
Response: 331 Password required
Command: PASS ***
Response: 230 User logged in.
Command: FEAT
Response: 211-Extended features supported:
Response: LANG EN*
Response: UTF8
Response: AUTH TLS;TLS-C;SSL;TLS-P;
Response: PBSZ
Response: PROT C;P;
Response: CCC
Response: HOST
Response: SIZE
Response: MDTM
Response: REST STREAM
Response: 211 END
Status: Text encoding: System.Text.UTF8Encoding
Command: OPTS UTF8 ON
Response: 200 OPTS UTF8 command successful - UTF8 encoding now ON.
Command: SYST
Response: 215 Windows_NT
Status: Listing parser set to: Windows
# DirectoryExists("BLOB/03 MyData/03 DataChanges")
Command: PWD
Response: 257 "/" is current directory.
Command: CWD BLOB/03 MyData/03 DataChanges
Response: 250 CWD command successful.
Command: CWD /
Response: 250 CWD command successful.
# SetWorkingDirectory("BLOB/03 MyData/03 DataChanges")
Command: CWD BLOB/03 MyData/03 DataChanges
Response: 250 CWD command successful.
# GetListing(null, Auto)
Command: PWD
Response: 257 "/BLOB/03 MyData/03 DataChanges" is current directory.
Command: TYPE I
Response: 200 Type set to I.
# OpenPassiveDataStream(AutoPassive, "LIST /BLOB/03 MyData/03 DataChanges", 0)
Command: EPSV
Response: 229 Entering Extended Passive Mode (|||21398|)
Status: Connecting to 10.9.10.11:21398
Command: LIST /BLOB/03 MyData/03 DataChanges
Response: 125 Data connection already open; Transfer starting.
+---------------------------------------+
Listing: 02-14-22 04:54PM <DIR> Archiv
Listing: 02-11-22 09:36AM <DIR> Error
Listing: 02-21-22 12:05PM 98621 TestFile-MyData-Export-21-02-2022.xlsx
-----------------------------------------
Status: Disposing FtpSocketStream...
# CloseDataStream()
Response: 226 Transfer complete.
Status: Disposing FtpSocketStream...
Status: Confirmed format Windows
# DownloadFileAsync("D:\TOOL\LOGS\MyData\DataChanges\TestFile-MyData-Export-21-02-2022.xlsx", "TestFile-MyData-Export-21-02-2022.xlsx", Overwrite, None)
# OpenReadAsync("TestFile-MyData-Export-21-02-2022.xlsx", Binary, 0, 0)
# GetFileSizeAsync("TestFile-MyData-Export-21-02-2022.xlsx", -1)
Command: SIZE TestFile-MyData-Export-21-02-2022.xlsx
Response: 213 98621
# OpenPassiveDataStreamAsync(AutoPassive, "RETR TestFile-MyData-Export-21-02-2022.xlsx", 0)
Command: EPSV
Response: 229 Entering Extended Passive Mode (|||21351|)
Status: Connecting to 10.9.10.11:21351
Command: RETR TestFile-MyData-Export-21-02-2022.xlsx
Response: 125 Data connection already open; Transfer starting.
Status: Disposing FtpSocketStream...
Response: 226 Transfer complete.
# MoveFile("TestFile-MyData-Export-21-02-2022.xlsx", "./Archiv/TestFile-MyData-Export-21-02-2022.xlsx", Overwrite)
# FileExists("TestFile-MyData-Export-21-02-2022.xlsx")
Status: Testing connectivity using Socket.Poll()...
Status: Disposing FtpSocketStream...
# Connect()
Status: Connecting to 10.9.10.11:21341
Response: 220 Microsoft FTP Service
Status: Detected FTP server: WindowsServerIIS
Command: USER DOMAIN\username
Response: 331 Password required
Command: PASS ***
Response: 230 User logged in.
Command: FEAT
Response: 211-Extended features supported:
Response: LANG EN*
Response: UTF8
Response: AUTH TLS;TLS-C;SSL;TLS-P;
Response: PBSZ
Response: PROT C;P;
Response: CCC
Response: HOST
Response: SIZE
Response: MDTM
Response: REST STREAM
Response: 211 END
Status: Text encoding: System.Text.UTF8Encoding
Command: OPTS UTF8 ON
Response: 200 OPTS UTF8 command successful - UTF8 encoding now ON.
Command: SYST
Response: 215 Windows_NT
Status: Listing parser set to: Windows
Command: SIZE /BLOB/03 MyData/03 DataChanges/TestFile-MyData-Export-21-02-2022.xlsx
Response: 213 98621
# FileExists("./Archiv/TestFile-MyData-Export-21-02-2022.xlsx")
Command: PWD
Response: 257 "/" is current directory.
Command: SIZE /Archiv/TestFile-MyData-Export-21-02-2022.xlsx
Response: 550 The system cannot find the path specified.
# Rename("TestFile-MyData-Export-21-02-2022.xlsx", "./Archiv/TestFile-MyData-Export-21-02-2022.xlsx")
Command: RNFR /TestFile-MyData-Export-21-02-2022.xlsx
Response: 550 The system cannot find the file specified.
Command: QUIT
Response: 221 Goodbye.
Status: Disposing FtpSocketStream...
# Dispose()
Status: Disposing FtpClient object...
Status: Disposing FtpSocketStream...
The text was updated successfully, but these errors were encountered:
FTP OS: Windows
FTP Server: WindowsServerIIS
Computer OS: Windows 10 20H2 (Build 19042.1526)
FluentFTP Version: 37.0.1.
Bug:
In the end, I run the following code (this is copied together a bit to keep it short):
This code also works perfectly. But in rare cases moving the file to the archive does not work. I have tried to trace this with the log.
It seems that the client sometimes loses the connection, and then reestablishes it. However, it loses the information of the current WorkingDirectory which causes the move not to work.
Logs :
The text was updated successfully, but these errors were encountered: