FileSystem.findFiles(var directory, String wildcard, bool recursive)
-
@Sawer Type File in the API browser to see all of the functions that are available for File objects.
https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring
-
@d-healey Thanks.
Do spaces in a path make the function not to work? because it's still now working. I'm wondering if it is that -
@Sawer Spaces in the paths are fine. Are you sure your array has been populated (use the script watch table to check)?
-
@d-healey True, I checked now and after I Compiled, the array is not yet populated.
-
@Sawer
Do all files work or only text files? Because I just want to get the name of each sample file in the project sample folder, using the FileSystem API. -
@Sawer All files, but the samples won't be in the project folder on the user's system.
Do your samples have a
.format
extension?Perhaps use this function
-
@d-healey the format was just an example name: the wildcard is "*.wav"
Will try that function now and give you a feedback. Thanks -
@d-healey For instance, I'm now trying the same thing with an XML, and still the array is not populated. Strange..
-
@Sawer Need to see more of your code to know what you're doing wrong.
-
@d-healey True.
inline function fetchSamplesDirectory(component, value) { if (value == 1) FileSystem.browseForDirectory(FileSystem.Desktop, function(folder) { if(isDefined(folder) && folder.isDirectory()) { var samplesPath = folder.toString(folder.FullPath); //samples directory variable var samplesArray = FileSystem.findFiles(samplesPath, "*.wav", false); //Array of samples Console.print(samplesArray); } }); };
I have not been iterating over the array cause it's still not populated.
-
@Sawer You don't need to pass a string to the findFiles function. Just pass in the
folder
variable. -
@d-healey Genius! Thanks, David.
-
@Sawer said in FileSystem.findFiles(var directory, String wildcard, bool recursive):
@d-healey Genius!
I will go down in history as the man who read the manual :p
-
From now on you will be addressed as Sir David Healey, Slayer of Hydra Tabs and Reader of the Manual.
-
@Christoph-Hart said in FileSystem.findFiles(var directory, String wildcard, bool recursive):
From now on you will be addressed as Sir David Healey, Slayer of Hydra Tabs and Reader of the Manual.
..and Custodian of the T-Shirts
Dont forget that...