Page 1 of 1

Directory Tree for External Hard Drive

Posted: Thu Jul 24, 2025 8:22 am
by JosephSClemente
Hi everyone,

I have an external hard drive for backup and storing files that are not used on a daily basis. The problem is that these files are often forgotten, and it is inconvenient to connect the drive just to browse through them.

Is there a way to automatically generate a directory tree listing of all the files on the external hard drive?
Thanks

Re: Directory Tree for External Hard Drive

Posted: Thu Jul 24, 2025 2:25 pm
by dunbarx
Hi, welcome to the forum.

A bit out of my lane, files and folders, but have you checked out both the "Files" and "Folders" functions in the dictionary? Pay attention to the "long" versions of each.

Craig

Re: Directory Tree for External Hard Drive

Posted: Thu Jul 24, 2025 3:06 pm
by Klaus
Hi Joseph,

welcome to the forum!

Check this page, that may be what you are looking for!
https://www.sonsothunder.com/devres/liv ... ile007.htm


Best

Klaus

Re: Directory Tree for External Hard Drive

Posted: Fri Jul 25, 2025 6:43 pm
by stam
Unnecessarily complex.

This is the handler I use to get the file paths of all files in a folder (can be a volume), that drills down recursively through all nested folders and can include a search pattern (eg extension/filetype):

Code: Select all

function recursiveFilesWithPattern pFolder, pPattern
   Local tPaths
   filter files(pFolder) with "*" & pPattern & "*"
   repeat for each line tFile in it
      put pFolder & slash & tFile & cr after tPaths
   end repeat
 
   filter folders(pFolder) without ".."
   repeat for each line tFolder in it
      put recursiveFilesWithPattern(pFolder & slash & tFolder, pPattern) after tPaths
   end repeat
   return tPaths
end recursiveFilesWithPattern
Of course this doesn't create an array with folders but you can either build this from the output of this handler or modify the handler to do this...