File traversal sort function

zhaozj2021-02-16  44

<%

Function Bianli (PATH)

'initiate path = server.mappath (path) set fso = server.createObject ("scripting.filesystemObject") set objFolder = fso.getfolder (path) set objfiles = objfolder.files

'Putting file names and file roads into Thefiles array int slot = 0 dim thefiles () redim thefiles (50) for each objfile in objfiles filename = Objfile.name filepath = split (objfile.path, "DOCS /") thepath1 = "./docs/ "thepath = thepath1 & filepath (1) Thefiles (slot) = filename &" ** "& thepath slot = slot 1 if slot> Ubound (thefiles) Then Redim preserve thefiles (slot 20) end if next redim PRESERVE Thefiles (slot) 'Bubble Sorting for i = 0 to Ubound (THEFILES) -2 for J = I 1 To Ubound (THEFILES) -1 IF Strcomp (Thefiles (I), Thefiles (j)) = 1 THEN TMP = thefiles (i) Thefiles (i) = thefiles (j) Thefiles (j) = TMP end if next Next 'output for i = 0 to ubound (thefiles) -1 para = thefiles (i) filename = split (PARA, " ** ", - 1, 1) (0) FilePath = Split (PARA," ** ", - 1, 1) (1)%>

---