Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Ordered content of a directory

It visualizes the content of a directory on the file server (alphabetically ordered).


<%
' quick-sort function.
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 in the folder:<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
'
' Quick-sort ordering
'
call QSort(matrice,0,numero_file)
'
' Shows the files
'
set fs=Nothing
for t=1 to numero_file
  response.write matrice(t)&"<br>"
next
%>


Download code...


Print this page


 

Inizio pagina

risorse per webmaster