I am able to filter by file type, but need to get just folders.
Example:
app.ListFolder("/sdcard/droidscript/","folder");
//Called when application is started.function OnStart(){ Only_Folders = []; //an empty array //Get the path of special folder. helps us get default storage path base = app.GetSpecialFolder( "Music" ); n1 = base.lastIndexOf("/"); //cut the base path till the index n1+1 pbase = base.substring(0,n1+1); lbase = app.ListFolder( pbase ); //list the default storage lsbase = lbase.toString(); //get the string representation of lbase labase = lsbase.split(","); //split lbase on ",". returns an array //Run the labase array through a loop which checks if an //item in the array is a file. If an item is a folder, add it to our //array Only_Folders. for(i=0; i<labase.length; i++) { exists = app.FolderExists( pbase + labase[i] ); if(exists) Only_Folders.push(labase[i]); } alert(Only_Folders); //Alert the Only_Folders array.}
app.ListFolder("/sdcard/Droidscript").filter( function(name){ return app.IsFolder("/sdcard/Droidscript/"+name); });
Can you give us a sample of the type of regex you have in mind?