<%
' Funzione quick-sort. ' Script creato da Zani Andrea ' Sub QSort(a,ilo,ihi) lo=ilo hi=ihi mezzo=a((lo+hi)/2) do while (a(lo)<mezzo) lo=lo+1 wend while (a(hi)>mezzo) hi=hi-1 wend if lo<=hi then t=a(lo) a(lo)=a(hi) a(hi)=t lo=lo+1 hi=hi-1 end if loop while (lo<=hi) if hi>ilo then call QSort(a,ilo,hi) if lo<ihi then call QSort(a,lo,ihi) End Sub response.Write("Files presenti:<p>") Set fs=CreateObject("Scripting.FileSystemObject") Set f=fs.GetFolder("c:\windows") set fc=f.Files numero_file=0 dim matrice(1000) for Each whatever in fc matrice(numero_file)=trim(whatever.name) numero_file=numero_file+1 next ' ' Ordinamento files con tecnica quick-sort ' una delle piu' veloci routine di ordinamento conosciute ' call QSort(matrice,0,numero_file) ' ' Visualizza i files ordinati alfabeticamente ' set fs=Nothing for t=1 to numero_file ' la lista sara' presente dall'elemento "1" dell'array response.write matrice(t)&"<br>" next %> |