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
- Listing out directories and files in Python
- Python | Move or Copy Files and Directories
- Python | Arrange Tuples consecutively in list
- Working with zip files in Python
- Working with PDF files in Python
- Downloading files from web using Python
- Working with csv files in Python
- Rename multiple files using Python
- Python | Reading .ini Configuration Files
- Python | How to use Multiple kv files in kivy
- Python | Merge two text files
- Writing files in background in Python
- Python | Sort and store files with same extension
- Reading and Writing to text files in Python
- Python | Create Archives and Find Files by Name
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.