<< Displaying Information From Directory Iterators This script displays the directory tree structure starting from a specific directory. The script prompts for a connection name and a start directory. It then proceeds to display all subdirectories at lower levels from that point. The script uses the recursive functionality of QSL subroutines to walk up and down the structure. If the connection name is empty, it assumes the directory is on a local drive. If the start directory is empty, Qedit starts from the current working directory. The start directory can be an absolute or relative path. If you use a relative path, you have to know what is the current working directory. Failing that, you might get a listing for another directory or get an error if the directory does not exist at that location. >> name QSLShowDir group "&Utility" command "Show &Dir"; sub getinitialinfo(promptmsg) result = dialog(promptmsg, 1, ""); if result.button = 1 then return result.enteredtext; else return "" endif endsub sub getdirlisting(connection, startdir, levelindicator) levelindicator = " " + levelindicator; if string(connection) = "" then localdir = getdirectoryiterator(startdir); dirseparator = "\"; else localdir = connection.getdirectoryiterator(startdir); dirseparator = "/"; endif repeat for direntry in localdir if direntry.canonicaltype = "directory" and direntry.name <> "." and -- Otherwise goes into a loop direntry.name <> ".." then writelog(levelindicator + direntry.name); nextlevel = direntry.path + dirseparator + direntry.name; getdirlisting(connection, nextlevel, levelindicator); endif endrepeat endsub -- Mainline startconn = getinitialinfo("Enter connection name:"); startdir = getinitialinfo("Enter starting directory:"); qedit.showscp = true; -- Open Script Control Panel if startconn = "" then writelog ("Listing for local " + startdir); connobject = ""; else writelog ("Listing for " + startdir + " on " + startconn); connobject = openconnection(startconn); endif getdirlisting(connobject, startdir, ""); << This script is from the QSL User Manual. April 2000. Directories at lower levels are automatically indented. For example, the output for a local directory would appear as: Listing for c:\personal Expenses 1999 January February Agenda Pictures Family Work Travel >>