Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Oct 7, 2021 15:38:02 GMT -5
Hi Everyone I am sure this has been asked before. I searched the forum but could not find anything. I need to be able to identify all the sub-directories in a directory to be able to delete some of them using rmdir. I want to identify the sub-directories and load them into a table. Thanks Dennis
|
|
|
Post by Chris Iverson on Oct 7, 2021 16:54:33 GMT -5
The FILES command, which is most often used to check if a file exists, lists all files and folders inside of the folder you specify.
dim folderInfo$(1, 1)
files StartupDir$, folderInfo$()
numFiles = val(folderInfo$(0, 0)) numFolders = val(folderInfo$(0, 1))
Print "List of files:" For x = 1 to numFiles print folderInfo$(x, 0) Next x
Print Print "List of folders:" For x = (numFiles + 1) to numFolders + numFiles print folderInfo$(x, 1) Next x
Do note, however, that the RMDIR command built-in to LB will not be able to delete a folder that contains files or other subfolders.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Oct 8, 2021 0:16:58 GMT -5
Thanks Chris! Saved me as usual And thanks for the warning on rmdir - I would have struggled to figure out why rmdir was not working!
|
|
|
Post by Rod on Oct 8, 2021 2:16:26 GMT -5
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Oct 8, 2021 5:01:10 GMT -5
Thanks Rod! Saves a lot of deciphering....
|
|
|
Post by Walt Decker on Oct 8, 2021 8:49:02 GMT -5
|
|