SortFileName


This script lists all files recursively, sorted by the actual file name (not the directory). This is useful for locating duplicates.

Warning:

This page is open for revisions. Please read the page history to make sure the editors are trusted before using this code.

Source

#!/bin/bash

find . ! -type d | sed 's/^\(.*\)\/\([^\/]*\)$/\2\t\1/' | sort -f | sed 's/\(.*\)\t\(.*\)/\2\/\1/'