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


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 "-"

Best regards

from "basic gold edition guide"

option nolet
LIBRARY "C:\Program Files (x86)\TrueBASIC GOLD v6\TBLibs\ExecLib.Trc"
Dim name$(1),size(1),dlm$(1),tlm$(1),type$(1)
Dim dirnames$(1)

Mat Redim dirnames$(100)
Input prompt "Give full path name for Dir":dir$
CALL Exec_ChDir(dir$)
CALL Exec_ReadDir("",name$(),size(),dlm$(),tlm$(),type$(),vname$)

for i=1 to Ubound(name$)
if type$(i)[1:1]="-" then
print name$(i),size(i),dlm$(i),tlm$(i)
input prompt "Rename(r),delete(d),continue(c)":action$
select case action$
case "r"
input prompt "New name?":newname$
Call Exec_Rename(name$(i),newname$)
case "d"
unsave name$(i)
case else
end select
end if
next i
if num_dirs>0 then
Mat Redim dirnames$(num_dirs)
num_dirs=0 ! reset directory counter
print "The following subs where found within the directory:"
MAT PRINT dirnames$
end if
input prompt "Examine (other directories) -> (y or n)?":more$
if lcase$(more$[1:1])="y" then flag=1
loop while flag=1



re: Exec_ClimbDir

In reply to (2e) the following from the manual explains:

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.

Calls to the routines take the following formats:
CALL Exec_ReadDir (template$, name$(), size(), dlm$(), tlm$(), type$(), vname$)
CALL Exec_ClimbDir (dir$, template$, name$(), size(), dlm$(), tlm$(), type$())

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:
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.