Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
+1 vote
in .NET FTP by (130 points)


We have a problem when trying to rename a file and move it after getting it in a local computer.

We use the following C# code:

bool rename = clientFtp.RenameFile(file.Path, moveToPath);

When we use something like that

  • file.Path = "/test/test/BlankPdf.pdf"
  • moveToPath = "test_treated/BlankPdf.pdf"

=> it works well.

But we want to rename & move the file to the folder of level N-1:

  • file.Path = "/test/test/BlankPdf.pdf"
  • moveToPath = "../test_treated/BlankPdf.pdf"

=> we got an error: The file path does not exist or is invalid. (code=2).

NB1: The target directory exists, because we create it before, if required.
NB2: We use edtFTPnetPRO 9.0.020.

Is it a problem of FTP path syntax ?

Or is it just impossible to rename & move a file to a folder of level N-1 ?

Thanks in advance for your answer.

1 Answer

0 votes
by (161k points)
It depends on the server as to whether it supports this syntax. There's no standard, and so some servers will and others won't.
by (130 points)
Thanks a lot for your answer.

Can you give me additional information to your answer ?
Is it a global FTP configuration ?

by (161k points)
No, it's dependent on the server.