HISE Logo Forum
    • Categories
    • Register
    • Login

    FileSystem.findFiles(var directory, String wildcard, bool recursive)

    Scheduled Pinned Locked Moved General Questions
    24 Posts 4 Posters 1.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Sawer @d.healey
      last edited by Sawer

      @d-healey An object and its id, maybe? something like "Object 0x3b35018" ?

      for (file in filesArray)
      { Console.print(file);  }  
      

      Here you go :)

      Probably it's a kind of different object, I get it.
      Is there a way to stringify it and get the name of the file?

      d.healeyD 1 Reply Last reply Reply Quote 1
      • d.healeyD
        d.healey @Sawer
        last edited by

        @Sawer Type File in the API browser to see all of the functions that are available for File objects.

        Link Preview Image
        HISE | Docs

        favicon

        (docs.hise.audio)

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        S 1 Reply Last reply Reply Quote 0
        • S
          Sawer @d.healey
          last edited by

          @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

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Sawer
            last edited by d.healey

            @Sawer Spaces in the paths are fine. Are you sure your array has been populated (use the script watch table to check)?

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            S 1 Reply Last reply Reply Quote 0
            • S
              Sawer @d.healey
              last edited by

              @d-healey True, I checked now and after I Compiled, the array is not yet populated.

              S 1 Reply Last reply Reply Quote 0
              • S
                Sawer @Sawer
                last edited by Sawer

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

                d.healeyD 1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey @Sawer
                  last edited by d.healey

                  @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

                  86a5b630-285d-480b-9e62-ee64de1d3490-image.png

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  S 2 Replies Last reply Reply Quote 0
                  • S
                    Sawer @d.healey
                    last edited by

                    @d-healey the format was just an example name: the wildcard is "*.wav"
                    Will try that function now and give you a feedback. Thanks

                    1 Reply Last reply Reply Quote 0
                    • S
                      Sawer @d.healey
                      last edited by

                      @d-healey For instance, I'm now trying the same thing with an XML, and still the array is not populated. Strange..

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • d.healeyD
                        d.healey @Sawer
                        last edited by

                        @Sawer Need to see more of your code to know what you're doing wrong.

                        Libre Wave - Freedom respecting instruments and effects
                        My Patreon - HISE tutorials
                        YouTube Channel - Public HISE tutorials

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          Sawer @d.healey
                          last edited by Sawer

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

                          d.healeyD 1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey @Sawer
                            last edited by d.healey

                            @Sawer You don't need to pass a string to the findFiles function. Just pass in the folder variable.

                            21f0a226-9f2f-4afc-8348-5fa396029486-image.png

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            S 1 Reply Last reply Reply Quote 1
                            • S
                              Sawer @d.healey
                              last edited by

                              @d-healey Genius! Thanks, David.

                              d.healeyD 1 Reply Last reply Reply Quote 0
                              • d.healeyD
                                d.healey @Sawer
                                last edited by

                                @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

                                Libre Wave - Freedom respecting instruments and effects
                                My Patreon - HISE tutorials
                                YouTube Channel - Public HISE tutorials

                                Christoph HartC 1 Reply Last reply Reply Quote 2
                                • Christoph HartC
                                  Christoph Hart @d.healey
                                  last edited by

                                  From now on you will be addressed as Sir David Healey, Slayer of Hydra Tabs and Reader of the Manual.

                                  LindonL 1 Reply Last reply Reply Quote 5
                                  • LindonL
                                    Lindon @Christoph Hart
                                    last edited by

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

                                    HISE Development for hire.
                                    www.channelrobot.com

                                    1 Reply Last reply Reply Quote 2
                                    • First post
                                      Last post

                                    44

                                    Online

                                    1.7k

                                    Users

                                    11.7k

                                    Topics

                                    102.3k

                                    Posts