ListDir()

List the contents of a directory: gets "children" of given directory, formats results as a table, and pastes into the worksheet (with header row by default) at the specified location.

Syntax

Public Function ListDir(dir As String, destination As String, _ 
                        fields As String, _ 
                        Optional getType As String = "both", _ 
                        Optional quiet As Boolean = False, _ 
                        Optional noHeaders as Boolean = False, _ 
                        Optional descendants as Boolean = False) As Integer

Input

ValueDescription
 dirFull path of directory for which contents will be listed.
 destinationRange (named or address) of top left cell where results should be pasted.
 fieldsComma-delimited list of table or directory attributes to retrieve (can be table or directory attributes; irrelevant attributes are ignored; a column will be created in the output table for each field specified). Available fields (attributes) for tables and directories can be found in the 1010data API documentation for the gettab and getdir transactions respectively. An additional field entrytype indicating dir or tab is also available.
 getType(optional) Can be dir, tab, or both. Defaults to both.
 quiet(optional) Set to true to suppress output to user in case of error. Defaults to false.
 noHeaders(optional) Set to true to return output without a header row listing the fields retrieved. Defaults to false (headers appear by default).
 descendants(optional) Set to true to include subdirectories and their contents. Defaults to false (only the specified directory).

Return value

ValueDescription
 0success
 1failure
 -1fatal error (further attempts are likely to fail, connectivity problem or the like)

Example

Example usage:
result = a1010data.ListDir("pub.demo.baseball", "sheet1!$A$1", "id,name,title,rows")

The above will generate the table below and paste it to sheet1!$A$1:

id name title rows
37429 pub.demo.baseball.master Players 15350
37433 pub.demo.baseball.batting Batting 78881
37434 pub.demo.baseball.pitching Pitching 32896
37435 pub.demo.baseball.fielding Fielding 59884
37436 pub.demo.baseball.allstars All-Star Teams 3707
37437 pub.demo.baseball.hof Hall of Fame 239
37438 pub.demo.baseball.managers Managers 2895
37439 pub.demo.baseball.teams Teams 2327
37440 pub.demo.baseball.awards Awards 1346
37441 pub.demo.baseball.postbatting Post-Season Batting 7439
37442 pub.demo.baseball.postpitching Post-Season Pitching 2776