Posted 14 May 2013 - 04:07 PM
Hello, I'm trying to find the best way of converting a directory tree into a table,
For example if I had a few files and folders:
how would I convert that into:
(Each file table inside the folder table would contain an indexed table of each line of the file)
I would need it to "scan" the lowest level directory too, folder in a folder in a folder in a folder (and so on…)
For example if I had a few files and folders:
/
/folder1/
/folder1/filea
/folder1/fileb
/folder1/filec
/folder2/
/folder2/filea
/folder2/fileb
/folder2/filec
/folder2/folder3/filea
/folder2/folder3/fileb
how would I convert that into:
files = {
folder1 = {
filea = {},
fileb = {},
filec = {},
},
folder2 = {
filea = {},
fileb = {},
filec = {},
folder3 = {
filea = {},
fileb = {},
},
},
}
(Each file table inside the folder table would contain an indexed table of each line of the file)
I would need it to "scan" the lowest level directory too, folder in a folder in a folder in a folder (and so on…)