I need to compress all image files in a recursive way in google drive

I have all the logic done, but in the router when I find a directory how can I go back and list all files in that directory?

The scenario automates the compression of images stored in a specific Google Drive folder. Here’s how it works:

  1. Monitor Folders: Watches a designated Google Drive folder for changes or new folders.
  2. Search Files: Searches for files and folders within the monitored folder, retrieving up to 1000 files.
  3. Process Each File:
  • Make sure it’s an image by mimeType and is not in webp format already
  • Retrieves the file from Google Drive.
  • Compresses the image to WebP format.
  • Sets a new filename with “.webp” extension.
  • Updates the original file with compressed data and new filename.
  • Updates the MIME type via API call.
  1. Folder Check: Ensures only files are processed, not folders - How do I process the files within nested folders???