ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] API FTP §R°£¾ã­Ó¸ê®Æ§¨???

[µo°Ý] API FTP §R°£¾ã­Ó¸ê®Æ§¨???

±qºô¸ô¤W§ä¨ìªº¤@¬qcode, ¦ý¤@ª½¦³°ÝÃD¡A
´N¬O²Ä¤G¦¸FtpFindFirstFile¥¦ªº­È´N·|¥X²{0¡A
¥i¬O¥¦©ú©ú´N¦³ InternetCloseHandle hList ¡A
¨ì²{¦bÁÙ¬O¤£ª¾¬°¦ó¤£¦æ !!!

http://www.dreamincode.net/code/snippet635.htm
Public Function FtpRemoveDirectory(ByVal hConnect As Long, ByVal dirName As String) As Boolean
    Dim hList As Long
    Dim WFDI As WIN32_FIND_DATA
    Dim fName As String
    Dim dirDepth As Byte
    Dim fileNum As Integer
   
    FtpSetCurrentDirectory hConnect, dirName
    DoEvents
    dirDepth = 1
   
loopPoint:
    While dirDepth
        hList = FtpFindFirstFile(hConnect, "*.*", WFDI, 0, 0)
        If hList Then
            Do
                fName = Left(WFDI.cFileName, instr(1,WFDI.cFileName, Chr(0),0)-1)
                If fName <> "." And fName <> ".." Then
                    If WFDI.dwFileAttributes = 16 Then
                        If FtpCommand(hConnect, False, 2, "rmd " & fName, 0, hTest) = False Then
                            FtpSetCurrentDirectory hConnect, fName
                            DoEvents
                            InternetCloseHandle hList
                            DoEvents
                            dirDepth = dirDepth + 1
                            GoTo loopPoint
                        End If
                    Else
                        FtpDeleteFile hConnect, fName
                    End If
                End If
            Loop While InternetFindNextFile(hList, WFDI)
        End If
        FtpSetCurrentDirectory hConnect, ".."
        DoEvents
        InternetCloseHandle hList
        DoEvents
        dirDepth = dirDepth - 1
    Wend
   
    InternetCloseHandle hList
    If FtpCommand(hConnect, False, 2, "rmd " & dirName, 0, hTest) = True Then
        FtpRemoveDirectory = True
    Else
        FtpRemoveDirectory = False
    End If
End Function

°ÝÃD¤w¸Ñ¡A­ì¨Ó³o¬qCODE ¬O¨S°ÝÃDªº¡A
´£¨Ñµ¹¤j®a°Ñ¦Ò!!!

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD