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
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.