Sort and organize media files with Mediapurge

Distribution Point

© Photo by Ramon Cordeiro on Unsplash

© Photo by Ramon Cordeiro on Unsplash

Article from Issue 229/2019

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 - | sudo apt-key add -
$ cd /etc/apt/sources.list.d
$ sudo wget
$ 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.

Figure 1: The buttons in the left sidebar guide you through the options for organizing your files.
Figure 2: Checking Read only registered file types tells Mediapurge to only consider file types that it supports.


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.

Figure 3: If you had a file named IMG-2019-06-01.png, the settings shown here would allow Mediapurge to sort it into a folder named 2019 and into a subdirectory named 06.

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.

Figure 4: Mediapurge has determined that the content of these two screenshots is the same.


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.

Figure 5: These settings tell Mediapurge to move a photo collection to the /home/dd/Pictures/archive directory.

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).

Figure 6: Enabling Replace allows Mediapurge to rename files. With these settings, IMG_2567.JPG would become Photo_2567.JPG.

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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Sunflower File Manager

    Sunflower is a highly configurable graphical file manager with two windows that implement an unusual concept by trying to integrate the command line with the file manager.

  • Jajuk

    Jajuk keeps track of your music collection and keeps the party going with a digital DJ.

  • Czkawka

    Czkawka helps find and remove duplicate and obsolete files to free up valuable disk space.

  • Metadata Cleanup Tools

    Digital camera images often reveal personal information embedded in metadata. Several Linux tools let you remove unwanted metadata to help preserve your privacy.

  • fdupes

    The command-line fdupes tool helps you find duplicate folders and directories.

comments powered by Disqus
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.

Learn More