<%@ LANGUAGE = VBScript%><%Option Explicit Dim SourceDir, fso, Indent, nl, SrcDrLen, tmp, TitleFile, Title,oConn,oRs,filePath,QryStr nl=vbCrLf Indent=0 Const ForReading = 1 SourceDir=Server.MapPath("./") Set fso = CreateObject("Scripting.FileSystemObject") Set SourceDir = fso.GetFolder(SourceDir) SrcDrLen=Len(SourceDir.Path)+2 ' Create ADO Connection Component to connect filePath = Server.MapPath("Adm_ThuyetPhap.mdb") Set oConn = Server.CreateObject("ADODB.Connection") oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath %> Collect MP3 Paths <% recur SourceDir oConn.Close 'Response.Redirect "Adm_Listmaintenance.asp" Sub Recur(DDir)'======================================================= Dim SubDir, File, PathName Dim a(10000),b,n,m,p 'Show folder path if it contains MP3 file For Each File in DDir.Files tmp=ucase(right(File.name,4)) if tmp=".MP3" then Set oRs = oConn.Execute("Select Path from ThuyetPhap where path='" & mid(DDir.Path,SrcDrLen) & "'") If oRs.EOF Then PathName = mid(DDir.Path,SrcDrLen) 'NOTE: INSERT query with a semicolon at the end doesn't work!!! Can't explain!!! 'Set oRs = oConn.Execute("INSERT INTO ThuyetPhap0 ([Path],UniqueID,DatePosted,AuthorID,CatID) VALUES ('" & PathName & "','" & right(PathName,4) & "',Date(),5,4)") QryStr="INSERT INTO ThuyetPhap0 ([Path],UniqueID,DatePosted,AuthorID,CatID) VALUES ('" & PathName & "','" & right(PathName,4) & "',Date(),5,4)" Response.write "New Folder: " & PathName & "
" & chr(13) & chr(13) Response.write "
" & chr(13) Response.write "
" & chr(13) Response.write "
" & chr(13) Response.write "Password:
" & chr(13) Response.write "" & chr(13) Response.write "


" & chr(13) & chr(13) Exit For end if end if Next 'Recur for each subfolders For Each SubDir in DDir.SubFolders recur SubDir Next End Sub'======================================================================= %>