what is pRecurse
Posted: Wed Jan 22, 2020 4:48 pm
can anyone clarify what pRecurse would represent as a parameter within a function?
' ' '
# Returns a list of files in a given folder, using recursion to
# include files in subfolders if desired.
function listFiles pFolder, pRecurse
local tTotalFiles, tCurrentFiles, tFolders
set the defaultFolder to pFolder
put filteredFiles() into tCurrentFiles
if not pRecurse then
return tCurrentFiles
end if
if tCurrentFiles is not empty then
put tCurrentFiles & return after tTotalFiles
end if
## Now the recursion
## We call listFiles passing a subfolder as an argument
put filteredFolders() into tFolders
repeat for each line tFolder in tFolders
put listFiles((pFolder & slash & tFolder), pRecurse) into tCurrentFiles
if tCurrentFiles is not empty then
put tCurrentFiles & return after tTotalFiles
end if
end repeat
delete the last char of tTotalFiles
return tTotalFiles
end listFiles
' ' '
this is copied from the livecode website, for recursively accessing embedded folders and files
however, I am unsure of what I actually need to pass into the function as the pRecurse parameter, is it a boolean??
' ' '
# Returns a list of files in a given folder, using recursion to
# include files in subfolders if desired.
function listFiles pFolder, pRecurse
local tTotalFiles, tCurrentFiles, tFolders
set the defaultFolder to pFolder
put filteredFiles() into tCurrentFiles
if not pRecurse then
return tCurrentFiles
end if
if tCurrentFiles is not empty then
put tCurrentFiles & return after tTotalFiles
end if
## Now the recursion
## We call listFiles passing a subfolder as an argument
put filteredFolders() into tFolders
repeat for each line tFolder in tFolders
put listFiles((pFolder & slash & tFolder), pRecurse) into tCurrentFiles
if tCurrentFiles is not empty then
put tCurrentFiles & return after tTotalFiles
end if
end repeat
delete the last char of tTotalFiles
return tTotalFiles
end listFiles
' ' '
this is copied from the livecode website, for recursively accessing embedded folders and files
however, I am unsure of what I actually need to pass into the function as the pRecurse parameter, is it a boolean??