JavaScript Development Space

List All Files in a Folder and Subfolders with Electron & React

9 November 20233 min read
Get a List of All Files in a Folder And All Subfolders using Electron and React

To get a list of all files in a folder and its subfolders using Electron and React, you can use the Input Event to read the directory and file information. Here's a basic example of how you can achieve this:

1. First, make sure you have Electron and React installed in your project:

npm create @quick-start/electron

Then follow the prompts!

Loading code editor...
Current folders structure

Electron Vite Initialization Options

2. Add Tailwind to Electron:

npm install -D tailwindcss

then...

npx tailwindcss init

Configure your template paths

Add the paths to all of your template files in your tailwind.config.js file.

Loading code editor...

Add the Tailwind directives to your src/renderer/src/assets/index.css files

Loading code editor...

Now add postcss.config.js file to your root directory.

Loading code editor...

Modify your src/preload/index.ts file to set an api route

Loading code editor...

Now add this code to App.ts inside the renderer folder

Loading code editor...

Run your app:

npm run dev

This example assumes that you have a basic understanding of Electron and React. Also, note that this example doesn't handle errors, and in a production environment, you should implement error handling for better robustness.

JavaScript Development Space

JSDev Space – Your go-to hub for JavaScript development. Explore expert guides, best practices, and the latest trends in web development, React, Node.js, and more. Stay ahead with cutting-edge tutorials, tools, and insights for modern JS developers. 🚀

Join our growing community of developers! Follow us on social media for updates, coding tips, and exclusive content. Stay connected and level up your JavaScript skills with us! 🔥

© 2025 JavaScript Development Space - Master JS and NodeJS. All rights reserved.