Sort and organize media files with Mediapurge
Distribution Point
If you have a download folder full of photos and music, Mediapurge can help you sort files and even remove duplicates, but beware of its quirks.
Mediapurge is a real jack of all trades. It sorts media into subdirectories based on file names or metadata, converts file names to reflect a uniform pattern, and removes duplicates from your hard disk. To detect duplicates, it analyzes content and even recognizes photos stored in different formats. If desired, the software synchronizes your collection with a backup on an external hard drive. Plus, it can convert a batch of audio files into another format.
Although the proprietary software originated in the Windows world, Mediapurge v6.61 introduces a free Linux version. If you are using Debian, Ubuntu, or one of their derivatives, you can download Mediapurge from the developers' repository using the commands in Listing 1. For a 32-bit system, replace archive
with archive-i386
.
Listing 1
Downloading Mediapurge
$ wget -O - http://archive.peter-ebe.de/keyFile | sudo apt-key add - $ cd /etc/apt/sources.list.d $ sudo wget http://archive.peter-ebe.de/peter-ebe-main.list $ sudo apt-get update $ sudo apt-get install mediapurge
For other distributions, download the appropriate tarball for your system [1], unpack it on your hard disk, change to the new usr/bin/
subdirectory, and call ./mediapurge
from there. If the program prompts you for canberra-gtk-module
at startup, install the libcanberra-gtk-module package via the software manager.
After agreeing to the license, the main window opens (Figure 1) and guides you through several steps to perform your desired task. To get started, select a function you want to perform, then the files, (Figure 2) change the settings if necessary, and let Mediapurge get to work.
Sorted
To tame a wild and woolly collection of holiday photos or music files, select Sort files to subdirectories in Step 1. The tool usually orients itself on the file name or the metadata (which is only possible with audio files). If you are working with audio files, select Build directory structure from tags; otherwise, select Build directory structure from file names.
Now fill the list with all files you want to sort. To select an entire directory, click on Add Directory; to select individual files, click on Add file selection. If you accidentally add an entry, it cannot be removed from the list individually. In this case, restart by pressing New.
Press Next to go to the next step. When sorting the media by file name, the tool is mainly guided by the specified Separator (Figure 3). If you have decided to sort by tags, select the desired criteria under Sort by. If you choose Artist, Mediapurge sorts all tracks by, say, Queen into a single folder. If you have only one track by Queen, but still want to assign it to its own folder, enable move individual files.
The software sorts the files directly in the respective directory. If you uncheck Source directory of media files and select a new destination directory, all sorted files will end up there. If you have specified several sources in the second step, you can bundle your photos in a folder in this way. Click Start to begin the process.
Duplicate Hunt
Step 1 also gives you an option to find duplicate files with Mediapurge. In the simplest case, the tool collects some information about each file, such as the tags in MP3 files, and compares them with the data in the other files. If this quick comparison is sufficient for you, select Duplicates (similar file information). Alternatively, you can let Mediapurge compare the contents bit by bit. To do this, select Duplicates (identical file copies).
As a third possibility, the software offers to analyze the files' contents. In the background, it generates hash values using a procedure (which is not described in detail) and then compares the hashes with each other. According to the developers, the process ignores small differences in volume and quality in audio material; for images, it ignores differences in brightness, contrast, and color as well as minor retouching.
To speed up a new duplicate search, the program remembers all fingerprints it creates using FFmpeg. If necessary, you can import this software via the package manager. Then go to Configuration | Decoder/Encoder settings and select Mediapurge apply default settings for FFmpeg.
In Step 2, select the files you want to process. To create file fingerprints with Mediapurge, uncheck Read only registered file types. The software then forwards all files to FFmpeg, which recognizes significantly more file types.
Press Start to begin the search for duplicates, which takes you directly to Step 5. After clicking on Start auto selection, Mediapurge shows all files that it thinks are duplicates. In the main window, you can press Delete duplicates directly or select the button to move the duplicate files to a folder. However, Mediapurge is often wrong. In my tests, it was particularly good at detecting duplicate photos of the same size with very similar motifs. On the other hand, it did not recognize thumbnails and scaled-down versions as duplicates.
Continue manual selection opens a window (Figure 4) where you can manually sort the duplicates. The list shows all the files with the same content. After clicking to select a file from the list, you can proceed to Delete. Clicking Keep deletes all other files except for the selected file. Select Next to scroll to the next duplicate. Clicking Open activates a preview.
Comparison
Mediapurge can synchronize a collection with a backup on an external hard disk. To do this, you first create a stock file: In the first step, click Synchronize media stock, then Select Directory, and add the files to be backed up. Then select Create inventory file and give the file a meaningful name. If there are already files at the destination, create an inventory file in the same way.
Next to Inventory 1, click on Select and select the first inventory file. Then click on Select next to Inventory 2 and enter the second inventory file. If there is no file here, click Empty and then Yes. Whatever the case, press the Create button next to Deficiency 2. The program creates a list of all files missing from the backup (i.e., Inventory 2).
Enter a file name for the list of missing files. You can copy the files found here by pressing Open next to Copy deficiency, selecting the list of missing files you just created, then clicking on Select next to Target path, defining the directory in which you want to store all the missing files, and finally selecting Copy files bottom right.
You can unify the media's file names by clicking Edit filenames and tags in Step 1 and then Edit filenames and tags. Select the files you want to modify, and then point and click to define the pattern for the new file names (Figure 6).
Mediapurge can also convert audio files. Select Convert files in Step 1, then select the files to be converted, define the desired Output format, and press Start to convert.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
System76 Refreshes Meerkat Mini PC
If you're looking for a small form factor PC powered by Linux, System76 has exactly what you need in the Meerkat mini PC.
-
Gnome 48 Alpha Ready for Testing
The latest Gnome desktop alpha is now available with plenty of new features and improvements.
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.