How do I know if a folder exists with Idftp Delphi?

Asked

Viewed 603 times

0

I need to know if a folder exists in ftp

I’m using the function below, but error:

---------------------------
Debugger Exception Notification
---------------------------
Project perfil.exe raised exception class EIdReplyRFCError with message 'Directory not found.
'.
---------------------------
Break   Continue   Help   
---------------------------

The function I’m using is this:

function FTPFileExists(aFileName: string): Boolean;
begin
  try
    fdm.IdFTP.List(nil, aFileName, False);
    Result := (fdm.IdFTP.ListResult.Count > 0);
  except
    Result := False;
  end;
end;

fdm is my datamodule and Idftp the Indy component Delphi is Xe6

  • What you are passing in the aFileName parameter?

  • I’m sorry, I’ll close this question, I ate ball at the time of passing the directory, crude error, function works, I’m able to create directories

  • I figured it was the wrong way, really, because I use a practically equal function...

  • 1

    Yeah, you know when you waste your time with something gross, you go out to air and when you come back you see the mistake...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.