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 –
- Python program to find files having a particular extension using RegEx
- Python | Repeat and Multiply list extension
- Python | Extension function operating on Arrays
- Python | Opaque Pointers in C extension modules
- C Extension Module using Python
- C API from Extension Module in Python | Set 1
- C API from Extension Module in Python | Set 2
- Python | Passing Filenames to Extension in C
- Python - Incremental List Extension
- Pafy - Getting Extension of Stream
- Python | Generate random numbers within a given range and store in a list
- Python program to reverse the content of a file and store it in another file
- Python - Store Function as dictionary value
- How to store Python functions in a Sqlite table?
- PyQt5 ComboBox - User entered items store at top
- Modify Numpy array to store an arbitrary length string
- PyQt5 ComboBox – User entered items store at selected position
- PyQt5 ComboBox – User entered items store after the selected position
- PyQt5 ComboBox – User entered items store before the selected position
- PyQt5 ComboBox – User entered items store alphabetical order
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.