FATSORT

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT
EXAMPLES
AUTHOR
REPORTING BUGS
COPYRIGHT

NAME

fatsort − FAT file system sorting utility

SYNOPSIS

fatsort [OPTIONS] DEVICE

DESCRIPTION

FATSort sorts the directory structure of FAT file systems, including FAT12, FAT16, FAT32, and exFAT.

Sort options:

−a

Use ASCII order for sorting.

−c

Ignore case of file names (default for most locales).

−I PFX

Ignore the prefix PFX when comparing file names.

−n

Use natural order sorting.

−o FLAG

Set the sort order of files, where FLAG is one of:

d : directories first (default)

f : files first

a : do not distinguish between files and directories

−r

Sort in reverse order.

−R

Sort in random order.

This option overrides all other sort options.

−t

Sort by last modification date and time.

The following options can be specified multiple times to control which directories are sorted:

−d DIR

Sort the specified directory DIR only.

−D DIR

Sort DIR and all its subdirectories.

−x DIR

Exclude DIR from sorting.

−X DIR

Exclude DIR and all its subdirectories from sorting.

The following options can be specified multiple times to select directories using POSIX.2 extended regular expressions:

−e RE

Only sort directories matching regular expression RE.

−E RE

Don’t sort directories matching regular expression RE.

Note: Options −e and −E cannot be used together with −d, −D, −x and −X.

−L LOC

Use the specified locale LOC instead of the system locale. FATSort follows locale−specific rules when sorting file names and directories.

More options:

−l

List the current file order only.

−i

Display file system information only.

−f

Force sorting even if the file system is mounted.

−h,

−−help

Display this help message.

−v, −−version

Show version information.

−q

Suppress all non−error output.

DEVICE must be a FAT12, FAT16, FAT32 or exFAT file system.

WARNING: THE FILE SYSTEM MUST BE CONSISTENT (I.E., FREE OF ERRORS) BEFORE RUNNING FATSORT. THERE IS A RISK OF FILE SYSTEM CORRUPTION. ALWAYS BACK UP YOUR DATA.

ENVIRONMENT

The environment variable LC_ALL determines the system locale used by FATSort.

EXAMPLES

fatsort /dev/sda

Sort /dev/sda.

fatsort −n /dev/sdb1

Sort /dev/sdb1 using natural order.

AUTHOR

Written by Boris Leidner.

REPORTING BUGS

Report bugs to <fatsort@formenos.de>.

COPYRIGHT

Copyright © 2004−2025 Boris Leidner. License GPLv2: GNU GPL version 2 (see LICENSE.txt)
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.