How to list all the files in a folder and its sub-folders in CSV format?
In this blog, we will explore how can we get the list of all the files in a folder and its sub-folder in CSV format using NodeJS APIs.
Repository Link
https://github.com/techwithmks/file-paths-to-csv
Steps to Follow
Follow the below-mentioned steps to quickly get the files list
- Install NodeJS in your system. Get a quick glance on this link to know how to install NodeJS in your system.
- If you have git installed in your system, clone above-mentioned repository using the following command.
Alternatively, you can download the repository itself. Just go to the repository link and click on the green coloured "Code" dropdown button.Download option at the github page - Go to config.js file, and add the source and destination absolute paths.
- source implies the folder's absolute path whose files need to be listed.
E.g. C:/Users/<user-name>/Documents/ - destination implies the csv absolute path of the CSV file where the output will be printed.
E.g. C:/Users/<user-name>/Documents/output.csv
- source implies the folder's absolute path whose files need to be listed.
- Execute the following command in the terminal
The output is printed in the csv file path provided in the destination key in the config.js.