MIT licensed and maintained by Travis Cardwell
This version can be pinned in stack with:phatsort-0.6.0.0@sha256:9b2a33b4a6f6074597caf70f2d0731e7fbbd152a8b5b310d5de6490e55967847,3502

PhatSort

Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub CI Hackage Stackage LTS Stackage Nightly

Overview

The PhatSort project provides two command-line utilities for sorting files and directories on FAT filesystems. The phatsort utility sorts files and directories that are already on the filesystem. The seqcp utility copies files and directories to the filesystem in sorted order.

There are many MP3 players that allow you to mount the device as external storage and manage the media yourself. The storage generally uses a FAT filesystem. When copying multiple files onto the storage, using the command line (cp/mv) or a GUI, they are generally stored in an arbitrary order. This is not a problem if the firmware of the MP3 player sorts by filename, but many MP3 players use the order in the FAT filesystem without sorting, which results in podcasts and album tracks being played out of order.

There are some utilities that sort the FAT tables of an unmounted filesystem. (See Related Software for information and links.) Unfortunately, there are many devices for which this does not work. PhatSort takes a different approach to solving the problem. It works by creating new directories and moving (“renaming”) the files in the desired order, while the filesystem is mounted. This method works on all devices that have been tried so far.

PhatSort also (optionally) forces the filesystem buffers to be written to the storage media after each change. This helps avoid write failures when using devices that have problems with writing large amounts of data. Note that the seqcp utility helps with this issue even on non-FAT filesystems.

CLI

Requirements

PhatSort has only been tested on Linux. It might work on other operating systems. Scripts that are output use POSIX shell commands and therefore require a POSIX shell to execute.

Installation

.deb Package Installation

Check the Releases page for .deb packages.

.rpm Package Installation

Check the Releases page for .rpm packages.

Installation From Hackage

Install PhatSort from Hackage using Cabal as follows:

$ cabal v2-install phatsort

Installation From Stackage

Install PhatSort from Stackage using Stack as follows:

$ stack install phatsort

Usage

See the phatsort and seqcp man pages for usage information.

Related Software

FATSort is a command-line utility that sorts unmounted FAT filesystems by direct manipulation of the FAT tables. Unfortunately, there are many devices for which this does not work.

YAFS is a command-line utility that sorts unmounted FAT filesystems by direct manipulation of the FAT tables. Visual YAFS provides a GUI. I have not tried either of these.

DriveSort is Windows GUI software that sorts unmounted FAT filesystems by direct manipulation of the FAT tables. I have not tried it.

Project

Links

Branches

The main branch is reserved for releases. It may be considered stable, and HEAD is always the latest release.

The develop branch is the primary development branch. It contains changes that have not yet been released, and it is not necessarily stable.

Hackage revisions are made for metadata changes, such as relaxation of constraints when new versions of dependencies are released. The phatsort.cabal metadata in the main branch may therefore not match that of Hackage. The phatsort.cabal metadata in the develop branch may match, unless work is being done on a new release that contains other changes.

Tags

All releases are tagged in the main branch. Release tags are signed using the [email protected] GPG key.

Contribution

Issues and feature requests are tracked on GitHub: https://github.com/ExtremaIS/phatsort-haskell/issues

Issues may also be submitted via email to [email protected].

License

This project is released under the MIT License as specified in the LICENSE file.

Changes

phatsort-haskell Changelog

This project follows the Haskell package versioning policy, with versions in A.B.C.D format. A may be incremented arbitrarily for non-technical reasons, but semantic versioning is otherwise followed, where A.B is the major version, C is the minor version, and D is the patch version. Initial development uses versions 0.0.0.D, for which every version is considered breaking.

The format of this changelog is based on Keep a Changelog, with the following conventions:

  • Level-two heading Unreleased is used to track changes that have not been released.
  • Other level-two headings specify the release in A.B.C.D (YYYY-MM-DD) format, with newer versions above older versions.
  • Level-three headings are used to categorize changes as follows:
    1. Breaking
    2. Non-Breaking
  • Changes are listed in arbitrary order and present tense.

0.6.0.0 (2023-05-28)

Breaking

  • Add support for optparse-applicative 0.18

Non-Breaking

  • Bump ansi-wl-pprint dependency version upper bound
  • Bump MonadRandom dependency version upper bound
  • Bump transformers dependency version upper bound
  • Bump unix-compat dependency version upper bound
  • Adjust dependency constraints to match tested versions

0.5.0.1 (2022-03-02)

Non-Breaking

  • Bump optparse-applicative dependency version upper bound

0.5.0.0 (2021-12-10)

Breaking

  • Add seqcp
  • Check that each target directory is not a mount point
  • Call sync system call via FFI instead of running the sync command

Non-Breaking

  • Add tests using mocking

0.4.0.0 (2021-06-25)

Breaking

  • Fix --help when using optparse-applicative 0.16

Non-Breaking

  • Refactor Nix configuration

0.3.0.0 (2021-05-27)

Breaking

  • Add support for optparse-applicative 0.16

Non-Breaking

  • Add .deb and .rpm packaging
  • Add Cabal support to Makefile
  • Add Cabal tests to GitHub Actions
  • Add stan static analysis

0.2.0.2 (2020-11-23)

Non-Breaking

  • Use GitHub Actions instead of Travis CI

0.2.0.1 (2020-11-08)

Non-Breaking

  • Rename Git default branch to main

0.2.0.0 (2020-07-26)

Breaking

  • Add syncing, --no-sync option

Non-Breaking

  • Refactor Makefile, add STACK_NIX_PATH support
  • Add test-all command to Makefile
  • Add Nix configuration

0.1.0.3 (2019-12-22)

Non-Breaking

  • Switch back to using LibOA instead of optparse-applicative-supplement

0.1.0.2 (2019-12-22)

Non-Breaking

  • Use optparse-applicative-supplement

0.1.0.1 (2019-12-22)

Non-Breaking

  • Add Travis CI
  • Turn off threading

0.1.0.0 (2019-12-21)

Breaking

  • Initial public release