This script automates the extraction of files from nested folders and deletion of empty folders. It can be useful for organizing and flattening a directory structure that contains nested folders with files.
Follow these steps to use the script:
- Ensure that you have Python installed on your machine.
- Install the required modules by running the following command in your command prompt or terminal:
pip install shutil
- Clone this repository to your local machine using the command:
git clone https://github.com/RanaShankani/extract_and_delete_folders.git โ
- Open a terminal or command prompt and navigate to the cloned repository directory:
cd extract_and_delete_folders
- Open the script file, extract_and_delete_folders.py, in a text editor or integrated development environment (IDE) of your choice.
- In the script, locate the line that specifies the root_folder variable:
root_folder = "your_root_folder"
- Replace the value of root_folder with the path to the root folder containing the nested folders you want to process. Make sure to use the appropriate path format for your operating system.
Save the changes you made to the script file.
- Open a terminal or command prompt and navigate to the repository directory.
- Execute the script by running the following command:
python main.py
- After running the script, check the specified root_folder to see the extracted files and the deleted empty folders.
extract_and_delete_folders is licensed under the MIT License. See the LICENSE file for details.
If you'd like to contribute to Extract and Delete Nested Folders, you can fork the repository and create a pull request with your changes. Please make sure to follow the contributing guidelines and adhere to the code of conduct.
If you have any questions or feedback, you can contact the project maintainer at [email protected]