Zet - How can I add a file system search when debugging a cordova app?

How can I add a file system search when debugging a cordova app?

You can add this. Tested on iOS

function listFiles(path, indent, maxDepth, currentDepth) {
  indent = indent || 0; // Default value if no indent is provided
  currentDepth = currentDepth || 0; // Default value if no current depth is provided

  if (maxDepth !== undefined && currentDepth > maxDepth) return; // Stop if max depth is reached

  window.resolveLocalFileSystemURL(path, function(directoryEntry) {
    var directoryReader = directoryEntry.createReader();
    directoryReader.readEntries(function(entries) {
      for (var i = 0; i < entries.length; i++) {
        var entry = entries[i];
        var indentation = "-".repeat(indent * 2); // 2 dashes per indentation level
        console.log(indentation + `${entry.isDirectory ? "📁" : ""} ` + entry.name);
        if (entry.isDirectory) {
          listFiles(entry.nativeURL, indent + 1, maxDepth, currentDepth + 1); // Recursive call for directories with increased indentation
        }
      }
    }, function(error) {
      console.log("Error reading directory: " + error.code);
    });
  }, function(error) {
    console.log("Error resolving file system URL: " + error.code);
  });
}

Then try calling with

listFiles(cordova.file.documentsDirectory,0,2);

#cordova