Have you ever wanted to find any particular file in a folder, but then completely freak out when you find that folder to be a hell of a mess? Well, Python is a rescue here.
Using Python OS-module and shutil module, we can organize the files with same extensions and store in separate folders.
Look at the image shown below –
This folder is fully unorganized. If you are told to find a particular file in this folder (or maybe an even larger folder with thousands of files), you will be stuck and become completely dumbstruck. It might be very tough (even impossible) to find a file from this ocean of mess. This problem can be solved using Python with a few lines of code. Let’s see how can we do this.
Below is the Python implementation –
- C API from Extension Module in Python | Set 1
- C Extension Module using Python
- C API from Extension Module in Python | Set 2
- Python | Passing Filenames to Extension in C
- Python | Generate random numbers within a given range and store in a list
- Python | Opaque Pointers in C extension modules
- Python | Extension function operating on Arrays
- Working with PDF files in Python
- Downloading files from web using Python
- Working with zip files in Python
- Working with csv files in Python
- Rename multiple files using Python
- Python | Reading .ini Configuration Files
- Python | Merge two text files
- Python | How to use Multiple kv files in kivy
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.