Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  List Folders
 
  chubbard posted this script:
  The following function takes a path to a folder in the web, and prints its subfolders recursively.

webcall function listFolders(szParent)
{
//if no folder is passed in, use root.
if(!szParent)
    szParent = "/";

if(Folder.exists(szParent))
    {
    //split folder path into parts
    var aPart = szParent.split("/");
    //get Folder object
    var fParent = Folder.getExisting(szParent);
   
    //get array of subfolders
    var aChild = fParent.Folders.getObjects();
    //write out subfolders beneath this folder
    for(var i = 0; i < aChild.length; i++)
        {
        for(var j = 0; j < aPart.length - 1; j++)
            response.write("&nbsp;&nbsp;&nbsp;");

        response.write("- " + aChild[i].name + "<br>");
        //call function recursively.
        listFolders(aChild[i].path);
        }
    }
}
 
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us