This Python script lists all folder names within a specified directory and saves them into an Excel file. Each time the script is run, it creates a new Excel file with a series number in the output
folder of the project.
- Lists all folder names within a specified directory.
- Saves folder names into an Excel file.
- Automatically creates a new Excel file with a series number each time the script is run.
- Automatically creates an
output
folder if it doesn't exist.
- Python 3.x
pandas
libraryopenpyxl
library
-
Clone the repository:
git clone https://github.com/yourusername/folder-list-to-excel.git cd folder-list-to-excel
-
Install the required libraries:
pip install -r requirements.txt
-
Run the script:
python script.py
-
Enter the directory path when prompted. For example:
Enter the directory path: /path/to/your/directory
-
The script will generate an Excel file in the
output
folder with a series number in the filename, such asfolder_list_00001.xlsx
.
If you have a directory structure like this:
/example_directory
├── folder1
├── folder2
└── folder3
And you run the script with /example_directory
as the input, the output
folder will contain an Excel file named folder_list_00001.xlsx
with the following content:
| Folder Names |
|--------------|
| folder1 |
| folder2 |
| folder3 |
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.