Function GenerateDirectoryListing(pF As FolderItem, pResource As String) As String ' for the sake of a realistic example, ' say that pF.ShellPath = "/home/ben/test-folder" ' and pResource = "/test-folder" dim f as FolderItem dim html,names(),s as string dim i,max,sizes() as integer f=pF if f.Directory then html=""+EndOfLine html=html+""+EndOfLine html=html+"Listing of "+pResource+""+EndOfLine html=html+""+EndOfLine html=html+""+EndOfLine html=html+"

Listing for "+pResource+"

"+EndOfLine html=html+"
"+EndOfLine
    for i=1 to f.Count
      names.Append f.item(i).Name
      if f.item(i).Directory then
        sizes.Append -1
      else
        sizes.Append f.item(i).Length
      end
    next
    max=30
    html=html+"Name"+RightBufferSpace("Name",max)+"Size
" html=html+"Parent Directory"+RightBufferSpace("Parent Directory",max)+"--"+EndOfLine if UBound(names)>-1 then for i=0 to UBound(names) s=names(i) if len(s)>max then s=left(s,max-3)+"..." end if rightb(pResource,1)="/" then html=html+""+s+""+RightBufferSpace(s,max) else html=html+""+s+""+RightBufferSpace(s,max) end if sizes(i)=-1 then html=html+"--"+EndOfLine else html=html+FormatSize(sizes(i))+EndOfLine end next end html=html+"
"+EndOfLine html=html+"

SAWS 0.1 (beta) running on port "+str(MyPort)+"

"+EndOfLine html=html+""+EndOfLine html=html+""+EndOfLine Return html else Return "" end End Function