Index and sort your media files

an overview
sourceforge download
intallation & user guide
have a look !
how you can reach us

Intall Java on your system, SUN J2SE version 1.4 or later. (

Unzip MediaSort package in a directory and edit build.xml file.
That's it, you can go directly to Usage section.

MediaSort has been tested successfully on Linux and Windows platforms using SUN J2SE 1.4 and Ant 1.6.5. It does not work with Microsoft JVM neither GCJ Java JVM.

  Optional installation
If you want to use MediaSort as an Ant FileMapper in your own Ant scripts, you should do the following intallation.

Intall Ant on your system, version 1.6.5 or later. (
You should have basic knowledge of Ant to get MediaSort FileMapper running.

Copy the following files :
- <MEDIA_SORT_HOME>/lib/mp3spi/*.jar
- <MEDIA_SORT_HOME>/lib/oggvorbis/*.jar
to <ANT_HOME>/lib directory.
(MEDIA_SORT_HOME is the home directory of MediaSort)

Add all <MEDIA_SORT_HOME>/lib libraries (excepted lib/ant) to a path in your and project and define the following mapper :

You can open <MEDIA_SORT_HOME>/build.xml to get an example.

Go to the directory where you unzipped MediaSort package.
Launch run.cmd on Windows Platform or on Linux Platform.
You should get the following Java Graphical User Interface :

  • Select a Source directory where are located the files to be sorted.
    The list of file extensions and Metadata Attributes available should appear.
  • In the filter field, you can remove file extensions to retrict the set of files.
    !!! File extensions are case sensitive and should be separated by semicolon ";" !!!
  • Select a Target directory where the sorted files will be copied.
  • Build a pattern to sort and rename your files.

    For example, the following pattern copies your mp3 files and sorts them by author and then title.

    [MP3 - author]/[MP3 - title].mp3

  • Finally, click "Copy" and go the the Console Tab to see what's happenning.

This should result in the following sort :

You can build your own path with any metadata attributes available in your files.

Some more examples :

  • Sort pictures by date:

    [Exif - Date/Time Original - Year]/[Exif - Date/Time Original - Year]_[Exif - Date/Time Original - Month]/[Exif - Date/Time Original - Year]_[Exif - Date/Time Original - Month]_[Exif - Date/Time Original - Date]_[Exif - Date/Time Original - Hour]_[Exif - Date/Time Original - Minute]_[Exif - Date/Time Original - Second]_[FS - Checksum].jpg

    The result is :

  • Sort pictures by camera model and then by width & height :

    [Exif - Model]/[Exif - Exif Image Width] X [Exif - Exif Image Height]/[FS - Name]_[FS - Checksum].jpg

    The result is :

  Usage : Copy, Move & Index
There are three ways to use MediaSort :
  1. Copy
    "Copy" copies your files from source to target. It sorts and rename them with the pattern you defined.
  2. Move
    "Move" moves your files from source to target. It erases all files in source. BE CAREFULL that some files might have the same metadata. If your pattern is not explicit enough, you might lose some files. To be sure we suggest you to use [FS - Checksum] in your pattern so that destination file names are unique.
  3. Index
    "Index" do not move neither copy your files. It creates a virtual tree to sort your files according to the pattern you defined. The index is stored in an XML file and rendered in an HTML javascript tree.

    You can create several indexes of the same files. For example you can have a tree view of your songs by year/author and another by album/author ! Or you can have a tree view of your pictures by year/month/date or by camera model/photo size/

    Indexes are saved in the config directory. See next section.

    Here is an example of two indexes of the same files :

  Usage : Open-Save Configurations
You can open/save your configuration.
  • Create a directory for your new config or index.
  • Use File>Open, File>Save and File>Save As .. menu.
Index and config files are stored in that directory.

  Usage : Ant FileMapper
Edit build.xml file and add the <sortmapper/> Ant FileMapper to your tasks

The following task copies your mp3 files and sorts them by author and then title.

It uses a Ant <copy/> with a custom mapper : <sortmapper/>

That mapper contains a pattern with the metadata attributes used for sorting and renaming :
<sortmapper from="C:\music\source" to="[MP3 - author]/[MP3 - title].mp3" />

Open a command or shell window and launch Ant task :

  Metadata attributes
Here are some metadata attributes. Available attributes depends on the file type.
The following list is not complete, see below to know all attributes available for a specific file.

File System attributes:

MP3 attributes:

OGG attributes:

EXIF attributes:

GPS attributes:

Iptc attributes:

Jpeg attributes:

Avi attributes:

Other attributes:

  • The Graphical User Interface shows you all known metadata attributes for the files located in the source directory.
    Just select them in the Metadata Attribute list, they are copied in the pattern field.
  • For Ant FileMapper users, the previous list is not complete. If you want to know the metadata attributes available for your file, you can use the <fileattribute/> custom Ant task. It diplays the list of known attributes for a given file :

    Then launch Ant task : ant ShowAttributes

    A list of all attributes available appears in the console.

MediaSort is based on an Ant file mapper. The file mapper uses a set of metadata attribute parsers AttributeParser.
Parser implementations have been developped for Jpeg, Mp3, Ogg, Pdf and Avi files. MediaSort can be easily extended with new parsers if needed.
Parsers are based on the following libraries :

Here is a link to the JavaDoc API documentation.

Copyright © 2006, Starobject S.A.. All Rights Reserved.
Web Design : Adam Particka. All Rights Reserved.