How to find out with truebasic all files from some sub directory.(use of Exec_ClimbDir)

Submitted by peter_vlasschaert on Sat, 09/14/2013 - 17:11

Halo

I don't understand very well how to use the command:CALL Exec_ClimbDir from the library "ExecLib.trc".
How to use this command to find out the sub directory from a directory.I hope some person can help me.
How to find all files inside the sub directories.

1e) a) below modified code make to understand :CALL Exec_ClimbDir

b) When use this code : I can not modified anything only
get direct sub directories from given directory or the files inside the directory.
How can find out what are sub directories and what are files by given directory.
c) How find out how many sub sub directories their are.

2e) if type$(i)[1:1]="-" then ---------------------> what meaning of this "-"

Comments

The Exec_ReadDir and Exec_ClimbDir subroutines provide list of names and statistics about the files saved
within a directory. Exec_ReadDir provides information on the files directly saved in the current directory, while Exec_ClimbDir provides information on the files in the designated directory along with those in subdirectories within that directory.

For the template$ argument, you may pass a string to select a subset of files (such as “*.TRU”). Specify anempty string if you do not wish to limit the search. For Exec_ClimbDir, you must specify the topmost directory to search in the dir$ argument; Exec_ReadDir searches the current directory.

Most of the information is returned in a series of one-dimensional arrays as follows:
name$() the names of the files (and possibly directories) in the current or specified directory (for
Exec_ReadDir the names are simple names of files in the current directory; for
Exec_ClimbDir the names are returned as full path names)

size() the sizes of the files in bytes
dlm$() the date last modified, in the True BASIC DATE$ function format “YYYYMMDD” where
“YYYY” is the four-digit year number, “MM” is the two-digit month number, and “DD”
is the two-digit day number
tlm$() the time last modified, in the True BASIC TIME$ function format “HH:MM:SS” where
“HH” is the two-digit 24-hour number, “MM” is the two-digit minute number, and “SS”
is the two-digit second number
type$() the type or access permissions given as a four-character string of the form:
“drwx”
where the first character is “d” if the entity is a directory and “-” if it is a file; the second
character is “r” if reading the file or directory is permitted and “-” otherwise; the third
character is “w” if writing or appending to the file or directory is permitted and “-” otherwise;
and the fourth character is “x” if the file is directly executable and “-” if not
(directories are not executable)

I don't have the time or desire to go much deeper, but your program above never calls the ClimbDir function. If it did, you would see the subdirectory names in name$() entries as these are returned as full path names. I suspect that if there are nested subdirectories, you would need to repeatedly call ClimbDir resetting dir$ to one of the subdirectories found in your first call.

Again--Chain out to a file handling program to do all this much more easily.