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 2
- C API from Extension Module in Python | Set 1
- C Extension Module using Python
- Python | Passing Filenames to Extension in C
- Python | Repeat and Multiply list extension
- Python | Extension function operating on Arrays
- Python | Opaque Pointers in C extension modules
- Python | Generate random numbers within a given range and store in a list
- Downloading files from web using Python
- Working with csv files in Python
- Working with zip files in Python
- Working with PDF files in Python
- Python | How to use Multiple kv files in kivy
- Python | Reading .ini Configuration Files
- Listing out directories and files in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.