Directory Tree for External Hard Drive

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JosephSClemente
Posts: 1
Joined: Thu Jul 24, 2025 8:18 am

Directory Tree for External Hard Drive

Post by JosephSClemente » Thu Jul 24, 2025 8:22 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: Directory Tree for External Hard Drive

Post by dunbarx » Thu Jul 24, 2025 2:25 pm

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

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Directory Tree for External Hard Drive

Post by Klaus » Thu Jul 24, 2025 3:06 pm

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

stam
Posts: 3064
Joined: Sun Jun 04, 2006 9:39 pm

Re: Directory Tree for External Hard Drive

Post by stam » Fri Jul 25, 2025 6:43 pm

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...

Post Reply