Putting Folder Names/Contents Into A Variable.
Posted: Sun Oct 28, 2018 5:49 am
Could anyone help me with putting folder contents into a variable?
Many Thanks,
Googie,
Many Thanks,
Googie,
Questions and answers about the LiveCode platform.
https://www.forums.livecode.com/
Code: Select all
on doChooseFolder
answer folder "open"
if it = empty then exit doChooseFolder
put LesFilesInFol(it) into tFiles
put tFiles
end doChooseFolder
function LesFilesInFol tFol -- return the list of files in a folder without ".*"
put empty into rLesFilesInFol
if there is a folder tFol then
put the Folder into tOldDF
set the Folder to tFol
put the files into rLesFilesInFol
set the Folder to tOldDF
filter rLesFilesInFol without ".*"
end if
return rLesFilesInFol
end LesFilesInFol
Code: Select all
put files([<targetFolder>, [short|long]])
All you really need (which I assume you have) is the folder you want the list of files from. The code is a couple of lines -
Code: Select all
// the folder you want to get the files from, in this case, I set the defaultFolder...
set the defaultFolder to "The folder you want the files from"
put the files into tmpList
// if you want *all* the files, hidden or no, omit the next line...
filter tmpList without ".*"
// use your variable, in this case I used answer...
answer tmpList
Code: Select all
answer folder "open"
put files(it) into tmpList
filter tmpList without ".*"
answer tmpList