- ©«¤l
- 33
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 74
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-6-9
- ³Ì«áµn¿ý
- 2024-5-17
|
¦^´_ 6# Joforn - Private Function FTPFolder(ByVal Url As String, _
- Optional ByVal UserName As String, _
- Optional ByVal PassWord As String, _
- Optional ByVal Port As Integer) As Object
- Dim objShell As Object
-
- If Len(Url) Then
- If Len(UserName) Then Url = UserName & ":" & PassWord & "@" & Url
- If Port > 0 Then Url = Url & ":" & Port
- Set objShell = CreateObject("Shell.Application")
- Set FTPFolder = objShell.Namespace("FTP://" & Url)
- End If
- End Function
- Sub test()
- Dim objFolder As Object
- Dim objItem As Object
- Dim selectFolder
-
- Set objFolder = FTPFolder("118.163.50.55/firmware_software_version_files/", "xxxxx", "xxxx")
-
- If Not (objFolder Is Nothing) Then
-
- selectFolder = objFolder
-
- Call ¦C¥XÀɮײM³æ(selectFolder)
- End If
- End Sub
- Sub ¦C¥XÀɮײM³æ(ByVal theDir As String)
- Dim pt As Range
-
- Set pt = Sheet1.Range("a2")
- Call ³]©w¼ÐÃD(1)
-
- If Len(Dir(theDir, vbDirectory)) > 0 Then
- If (GetAttr(theDir) And vbDirectory) = vbDirectory Then
- Call FileIOUtility.RetrivalFileList(theDir, pt, 0)
- End If
- End If
-
- pt.Worksheet.Columns("A:B").AutoFit
- End Su
- Function RetrivalFileList(ByVal strDir As String, ByRef myRange As Range, ByRef depth As Integer)
- Dim thePath As String
- Dim strSdir As String
- Dim theDirs As Scripting.Folders
- Dim theDir As Scripting.Folder
- Dim theFile As Scripting.File
- Dim myFso As Scripting.FileSystemObject
- Dim subFolderCount As Integer
-
- Set myFso = New Scripting.FileSystemObject
- If Right(strDir, 1) <> "" Then strDir = strDir & ""
- thePath = thePath & strDir
-
- '¦C¥X²Ä¤@¼h®Ú¥Ø¿ýªºÀÉ®×
- If depth = 0 Then
- For Each theFile In myFso.GetFolder(strDir).Files
- myRange = theFile.Path
- myRange.Next = theFile.Size
- myRange.Next.Next = theFile.DateLastModified
- Set myRange = myRange.Offset(1, 0)
- Next
- depth = 1
- End If
-
- '´M§ä©Ò¦³¤l¥Ø¿ýªºÀÉ®×
- Set theDirs = myFso.GetFolder(strDir).SubFolders
- For Each theDir In theDirs
- For Each theFile In theDir.Files
- myRange = theFile.Path
- myRange.Next = theFile.Size
- myRange.Next.Next = theFile.DateLastModified
- Set myRange = myRange.Offset(1, 0)
- Next
- RetrivalFileList strDir:=theDir.Path, myRange:=myRange, depth:=depth
- Next
- Set myFso = Nothing
- End Function
-
½Æ»s¥N½X §Ú±NÀɮ׸ô®|¥áµ¹selectFolder¡A·|¥X°ÝÃD
¦ý¦pªG§Úµ¹selectFolder ªº¸ô®|¬O¹q¸£¥»¾÷ªº«o¥i¥H°õ¦æ¡A
µ¹selectFolder §¹¾ãªºFTP¸ô®|¤]·|¥X¿ù¡A
¬O¦]¬°FTP¬d¸ßªº¤è¦¡¸ò¥»¾÷ªº¤£¤@¼Ë¶Ü?? |
|