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
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.