Recursive folder creation

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Aug 7 13:57:04 EDT 2017


Attempts to create a subfolder below a folder that does not exists fail.

Where folder "nature" exists but folder "2017" does not, attempt to create folder "birds" below 2017  fail.

put specialFolderPath["Documents"] into tDF

#  "/media/audio/nature" #these folders exist
# /2017/birds"   # does not, yet.

put tDF & "/media/audio/nature/2017/birds" into tFolder

create folder tFolder
put the result

"can't create that directory"

OK so… if I remove the "/2017" from my test path string and run it… we get the folder created as expected, where the new folder is a subfolder of an already existing folder.

Ok so this all makes perfect sense, but before I go looping thru the path to check for existence of each folder in the hierarchy and creating it if I does not exist. I was wondering

1) am I missing something or is this just expected behavior

and

2) Does it make sense to ask for an enhancement request for the engine to recursively create folders for a path where itemdel "/" and items -1,-2,-3 (sub folders) do not exist?

on unix

cp --parents 'a/b/c'  'audio/nature'

# will do this job… and you get

audio/nature/a/b/c

on disk

so I suppose one could resort to shell but this is not available on mobile. Hence the engine enhancement request.

meanwhile back to writing a repeat loop to check on sub folder and create on the fly. From all I'm seeing the CPUs  of all phones of all grades hardly have an issue, bencemark wise with this kind of processing… all the "trouble" is at the rendering layer.  From beta test reports where some rather snakey code is executed equally fast on all phones, but not anything having to do with pixels…e.g. fetch, process and assemble data to push to 100 sub-groups of a big scrolling group… wink of an eye… actually build and layout the sub-groups in the UI and display: slow as molasses on android.

BR





More information about the use-livecode mailing list