List remote files with special characters using .NET library
Hi,
I need some help listing files with special characters. The code is working all ok except for these files with special characters.
The actual file names in the remote directory are as follows:
So I can see
The error I get is as follows;
I need some help listing files with special characters. The code is working all ok except for these files with special characters.
The actual file names in the remote directory are as follows:
1235677-[Test].inf 2021-Test_µM.tds
[
is being escaped in the log.
The error I get is as follows;
Error: An error occurred while enumerating through a collection: Error listing directory '/Archive/1235677-[[]Test].inf'.
No such file or directory.
Error code: 2
Error message from server: Directory: /Archive/1235677-[[]Test].inf does not exist. [/b]
2024-12-03 13:02:26.527 Script: ls -- "/Archive/" . 2024-12-03 13:02:26.636 Listing directory "/Archive". > 2024-12-03 13:02:26.745 Type: SSH_FXP_OPENDIR, Size: 30, Number: 1291 < 2024-12-03 13:02:26.855 Type: SSH_FXP_STATUS, Size: 40, Number: 1028 . 2024-12-03 13:02:26.980 Discarding reserved response < 2024-12-03 13:02:27.089 Type: SSH_FXP_HANDLE, Size: 10, Number: 1291 > 2024-12-03 13:02:27.198 Type: SSH_FXP_READDIR, Size: 10, Number: 1548 < 2024-12-03 13:02:27.308 Type: SSH_FXP_NAME, Size: 195, Number: 1548 > 2024-12-03 13:02:27.417 Type: SSH_FXP_READDIR, Size: 10, Number: 1804 < 2024-12-03 13:02:27.527 Type: SSH_FXP_STATUS, Size: 17, Number: 1804 < 2024-12-03 13:02:27.636 Status code: 1 > 2024-12-03 13:02:27.745 Type: SSH_FXP_CLOSE, Size: 10, Number: 2052 . 2024-12-03 13:02:27.855 .;D;0;2024-12-03T19:01:18.000Z;4;"" [0];"" [0];rwxrwxrwx;1 . 2024-12-03 13:02:27.964 ..;D;0;2024-12-03T19:01:18.000Z;4;"" [0];"" [0];rwxrwxrwx;1 . 2024-12-03 13:02:28.073 1235677-[Test].inf;-;1184;2024-12-03T09:34:13.000Z;4;"" [0];"" [0];rwxrwxrwx;1 . 2024-12-03 13:02:28.183 2021-Test_µM.tds;-;262144;2024-12-03T19:00:30.000Z;4;"" [0];"" [0];rwxrwxrwx;1 < 2024-12-03 13:02:28.292 Script: Drwxrwxrwx 0 4096 Dec 3 13:01:18 2024 . < 2024-12-03 13:02:28.402 Script: Drwxrwxrwx 0 4096 Dec 3 13:01:18 2024 .. < 2024-12-03 13:02:28.511 Script: -rwxrwxrwx 0 1184 Dec 3 3:34:13 2024 1235677-[Test].inf < 2024-12-03 13:02:28.636 Script: -rwxrwxrwx 0 262144 Dec 3 13:00:30 2024 2021-Test_µM.tds > 2024-12-03 13:02:29.105 Script: ls -- "/Archive/1235677-[[]Test].inf/" . 2024-12-03 13:02:29.230 Listing directory "/Archive/1235677-[[]Test].inf". > 2024-12-03 13:02:29.355 Type: SSH_FXP_OPENDIR, Size: 51, Number: 2315 < 2024-12-03 13:02:29.464 Type: SSH_FXP_STATUS, Size: 40, Number: 2052 . 2024-12-03 13:02:29.573 Discarding reserved response < 2024-12-03 13:02:29.683 Type: SSH_FXP_STATUS, Size: 86, Number: 2315 < 2024-12-03 13:02:29.792 Status code: 2, Message: 2315, Server: Directory: /Archive/1235677-[[]Test].inf does not exist., Language: . 2024-12-03 13:02:29.902 Asking user: . 2024-12-03 13:02:30.027 Error listing directory '/Archive/1235677-[[]Test].inf'. ("No such file or directory. . 2024-12-03 13:02:30.152 Error code: 2 . 2024-12-03 13:02:30.261 Error message from server: Directory: /Archive/1235677-[[]Test].inf does not exist.") < 2024-12-03 13:02:30.370 Script: Error listing directory '/Archive/1235677-[[]Test].inf'. < 2024-12-03 13:02:30.480 Script: No such file or directory. < 2024-12-03 13:02:30.589 Error code: 2 < 2024-12-03 13:02:30.698 Error message from server: Directory: /Archive/1235677-[[]Test].inf does not exist. . 2024-12-03 13:02:30.808 Answer: Abort . 2024-12-03 13:02:30.917 Script: Failed > 2024-12-03 13:02:32.995 Script: exit . 2024-12-03 13:02:33.136 Script: Exit code: 1 . 2024-12-03 13:02:33.245 Closing connection. . 2024-12-03 13:02:33.355 Sending special code: 1 . 2024-12-03 13:02:33.464 Session sent command exit status 0 . 2024-12-03 13:02:33.573 Main session channel closed . 2024-12-03 13:02:33.698 All channels closed