FoxPro and .NET Interop
wwFtpClient.prg:CreateDirectory don't use the Fluent .NET Interop object
Gravatar is a globally recognized avatar based on your email address. wwFtpClient.prg:CreateDirectory don't use the Fluent .NET Interop object
  Toni Köhler
  All
  Apr 3, 2026 @ 05:58am

Hi Rick,

the function CreateDirectory() is a copy of depricated wwFtp.prg and don't work in wwFtpClient.prg

Wrong code as copy of wwFtp.prg

FUNCTION CreateDirectory()
LPARAMETER lcPath

IF EMPTY(lcPath) 
   RETURN .F.
ENDIF
   
DECLARE INTEGER FtpCreateDirectory ;
   IN WININET.DLL ;
   INTEGER hConnect,;
   STRING lpszDirectory

IF FtpCreateDirectory(THIS.hftpsession,lcPath)=0
   THIS.nError = GetLastError()
   THIS.cErrorMsg = THIS.GetSystemErrorMsg()
   RETURN .F.
ENDIF

RETURN .T.	
ENDFUNC

Solution to resolve this bug

FUNCTION CreateDirectory()
LPARAMETER lcPath

IF EMPTY(lcPath) 
   RETURN .F.
ENDIF

IF !this.oFtpClient.CreateDirectory(lcPath)
   THIS.cErrorMsg = this.oFtpClient.ErrorMessage
   RETURN .F.
ENDIF

RETURN .T.	
ENDFUNC

Please fix / implement this in one of you next versions.

Gravatar is a globally recognized avatar based on your email address. re: wwFtpClient.prg:CreateDirectory don't use the Fluent .NET Interop object
  Rick Strahl
  Toni Köhler
  Apr 3, 2026 @ 12:12pm

Thank you,

Fixed on this end. The function exists in the .NET code and you can fix with:

************************************************************************
*  CreateDirectory
****************************************
***  Function: Creates a directory on the server.
***    Assume:
***      Pass: lcPath - Server relative path to create
***    Return:
************************************************************************
FUNCTION CreateDirectory()
LPARAMETER lcPath

IF EMPTY(lcPath) 
   THIS.cErrorMsg = "You must provide a path to CreateDirectory()."
   RETURN .F.
ENDIF
   
IF !this.oFtpClient.CreateDirectory(lcPath)
   THIS.cErrorMsg = this.oFtpClient.ErrorMessage
   RETURN .F.
ENDIF

RETURN .T.	
ENDFUNC

+++ Rick ---

© 1996-2026