In this article, we will learn how to arrange the files in different directories according to their extensions. When you have a lot of files with different extension than you can simply use the script for your help.
Below is the Python implementation –
Files Not Arranged:
['arrange.py', 'mydata.pdf', 'python.exe', 'resume.doc'] ['py', 'pdf', 'exe', 'doc'] py arrange.py pdf mydata.pdf exe python.exe doc resume.doc
- How to move Files and Directories in Python
- Listing out directories and files in Python
- Python | Move or Copy Files and Directories
- Python: Get List of all empty Directories
- Python | Arrange Tuples consecutively in list
- Working with PDF files in Python
- Downloading files from web using Python
- Working with zip files in Python
- Working with csv files in Python
- Writing files in background in Python
- Python | Merge two text files
- Python | Reading .ini Configuration Files
- Python | How to use Multiple kv files in kivy
- Rename multiple files using Python
- Python | Sort and store files with same extension
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.