²»Ê¹ÓÃAPI»ñµÃÖ¸¶¨Îļþ¼ÐÎļþÁбí
×î½üΪһ¸ö¸è³Ç°²×°vodϵͳʱ£¬ÐèÒªÕÒ³ö²»Í¬Ä¿Â¼µÄÖظ´¸èÇúºÍË𻵸èÇúÎļþ£¬ÕâÊÇÎÒ±àдµÄ2ÖÖ²»Ê¹ÓÃAPIÁгöÖ¸¶¨Îļþ¼ÐÏÂËùÓÐÎļþ£¨°üº¬×ÓÎļþ¼Ð£©µÄ·½·¨¡£ Á½ÖÖ·½·¨¶¼Ö§³Ö±¾µØ´ÅÅÌĿ¼(ÐÎÈç: E:\Folder\)ºÍÍøÂç¹²ÏíĿ¼(ÐÎÈç: \\server\Share\)µÚÒ»ÖÖ£¬ ÀûÓÃScripting.FileSystemObject¶ÔÏó¡£´Ë·¨ÓŵãÊÇ¿ÉÒÔͬʱµÃµ½Îļþ´óСºÍÊôÐÔ£¬È±µãÊÇijЩϵͳĿ¼Ҳ¿ÉÄܱ»Áгö¡£ÇëÏÈÒýÓÃMicrosoft Scripting Runtime (%system%\scrrun.dll) Public Sub SaveFileListOfPath(strFileFullPath As String) 'goodidea 2004/10/02 Dim strFileFullName As String Dim fso As New Scripting.FileSystemObject 'ÉêÃ÷²¢ÊµÀý»¯FileSystemObject¶ÔÏó Dim d As Scripting.Folder Dim sd As Scripting.Folder Dim f As Scripting.File On Error Resume Next Forms(0).lblStatus.Caption = "ÕýÔÚÁ¬½Óµ½: " & strFileFullPath Forms(0).Repaint Set d = fso.GetFolder(strFileFullPath) 'ʵÀý»¯Folder¶ÔÏó 'Debug.Print Err.Number, Err.Description i = 0 For Each f In d.Files 'Ñ»·Îļþ¼ÐÖÐÿһ¸öÎļþ If Err.Number = 70 Then Debug.Print "¾Ü¾ø: ", d.Path strFileFullName = f.Path If i >= 10 Then 'Êʵ±µÄʱºò¸ø³öһЩÌáʾ me.lblStatus.Caption = strFileFullName me.Repaint i = 0 End If i = i + 1 '°ÑÎļþÐÅϢдÈëµ½±íÖУ¬ g_cnnÊÇÒ»¸ö¹«¹²µÄADO.Connection¶ÔÏó g_cnn.Execute "insert into [tbl_file_list_temp] ([filename],[FullName],[size])" & _ " values(""" & f.Name & """,""" & f.Path & """, " & f.Size & ")" Next Set f = Nothing For Each sd In d.SubFolders 'Ñ»·Ã¿Ò»¸ö×ÓÎļþ¼Ð Debug.Print sd.Path, sd.Type, sd.Attributes, sd.ShortName If UCase(sd.ShortName) <> "RECYCLER" Then Call SaveFileListOfPath(sd.Path) 'µÝ¹éµ÷Ó㬻ñµÃÎļþÁбí End If Next me.lblStatus.Caption = "×ÜÎļþ¸öÊý: " & g_cnn.Execute("select count(*) from [tbl_file_list_temp] ").GetString me.Repaint Set fso = Nothing Set d = Nothing Set sd = Nothing End Sub µÚ¶þÖÖ£¬ ÀûÓÃOffice.FileSearch¶ÔÏó¡£´Ë·¨ÓŵãÊÇËÑË÷OfficeÎļþ¸ü¼Ó·½±ã£¬ËÑË÷×ÓĿ¼ÎÞÐèµÝ¹é¡£ÇëÏÈÒýÓÃMicrosoft Office ojbect Library (%system%\scrrun.dll) Public Sub SaveFileListOfPath2(strFileFullPath As String) 'goodidea 2004/10/01
Dim strFileFullName As String Dim objFileSearch As Office.FileSearch Set objFileSearch = Application.FileSearch '»ñÈ¡FileSearch¶ÔÏó With objFileSearch .NewSearch '¿ªÊ¼ÐµÄËÑË÷ .MatchAllWordForms = True .SearchSubFolders = True 'ËÑË÷×ÓĿ¼ .FileType = msoFileTypeAllFiles 'ËÑË÷µÄÎļþÀàÐÍΪËùÓÐÎļþ .LookIn = strFileFullPath 'ÔÚÖ¸¶¨Ä¿Â¼ÖÐËÑË÷ me.lblStatus.Caption = "ÕýÔÚÁ¬½Ó : " & strFileFullPath me.Repaint .Execute msoSortByFileName 'Ö´ÐÐËÑË÷ For i = .FoundFiles.Count To 1 Step -1 'Ñ»·ËÑË÷½á¹û strFileFullName = .FoundFiles(i) If i Mod 5 = 0 Then '¸ø³öÌáʾ me.lblStatus.Caption = strFileFullName me.Repaint End If '°ÑËÑË÷½á¹ûдÈë±íÖÐ, g_cnnÊÇÒ»¸ö¹«¹²µÄADO.Connection¶ÔÏó g_cnn.Execute "insert into [tbl_file_list_temp] ([filename],[FullName])" & _ " values(""" & gf_getFileNameOfFullName(strFileFullName) & """,""" & strFileFullName & """)" Next End With me.lblStatus.Caption = "×ÜÎļþ¸öÊý: " & g_cnn.Execute("select count(*) from [tbl_file_list_temp] ").GetString me.Repaint Set objFileSearch = Nothing End Sub
--------------------------------------------------------------------------------
Ïà¹ØÎÄÕÂ
ÆÊÎö Declare Óï¾ä 2004-1-28 15:08:06
Á˽â Microsoft Access °²È«ÐÔ 2003-11-13 11:21:08
·ÀÖ¹Access 2000ÃÜÂë±»ÆÆÒëµÄ·½·¨ 2003-11-13 11:14:21
ACCESSµÄÊý¾Ý¿â°²È«ÎÊÌâ½â´ð 2003-11-13 10:52:11
ÈçºÎÕï¶Ï/ÐÞ¸´Ëð»µµÄ Jet 4.0 Êý¾Ý¿â 2003-10-14 8:31:26
³ÌÐò´ò¿ªËٶȻºÂý 2003-10-14 8:29:22
¶¨Æڹ鵵 Access Êý¾Ý¿â¼Ç¼ 2003-10-10 10:20:08
AccessÆô¶¯ÃüÁîÐÐÑ¡Ïî´óÈ« 2003-10-10 10:02:00
ÊÔͼÆô¶¯ÈÎÒâ Microsoft Access Ïòµ¼Ê±¸ÃÏòµ¼È´²»Æô¶¯ 2003-10-6 16:10:31
|