Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get Current Directory in Ftp Class
Message
From
09/07/2003 04:43:26
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00807877
Message ID:
00808366
Views:
21
>Still Can't solve the problem
>I modify your list into like this :
>
>
>#Define INTERNET_MAX_PATH_LENGTH 2048
>
>PROCEDURE GetFtpDirectory
> LPARAMETERS lcDirectory
> LOCAL fResult, RemoteDir, RemoteDirLength
>
> IF THIS.OpenFtpConnection() && Open an FTP Handle
> RemoteDirLength = INTERNET_MAX_PATH_LENGTH
> RemoteDir = repl(chr(0), 2048)
>
> fResult = FtpGetCurrentDirectory(this.nConnect_Handle, @RemoteDir, @RemoteDirLength)
>
> THIS.GetExtendedError()
> LcDirectory = left(RemoteDir, RemoteDirLength)
>
>
> THIS.CloseFtpConnection()
>
> IF fResult = 1
> RETURN .T.
> ELSE
> RETURN .F.
> ENDIF
> ENDIF
>
>ENDPROC
>
>
>I Called the procedure :
>
>newDirectory = 'Testing'
>
>IF !sz_ftp.GetFtpDirectory(NewDirectory)
> MESSAGEBOX("--- Directory Exist",16,"Information")
> RETURN
>ENDIF
>
>
>But Still Can't Check the existing Drive in FTP..
>
>Any Suggestion...
>
>thx

Tut,

You should set newDirectory to '' prior to calling your sz_ftp.GetFtpDirectory(). Also, put an @ before the parameter : sz_ftp.GetFtpDirectory(@NewDirectory)

It appears to me that you are using ftpGetCurrentDirectory() to check whether a directory exists.
The vfp equivalent of ftpGetCurrentDirectory() is curdir()

If you want to know whether a directory exists, then there are two options imo

(1) FtpSetCurrentDirectory(), ie a CD, if successful it exists, if not, it does not exist

(2) make a dir() command, using FtpFindFirstFile() and successive InternetFindNextFile()


It's not clear to me what you want to do
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform