Skip to content

mholzen/find-sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Find And Sort

This program walks files and directories and sorts them by date, size, name or path. The purpose of this tool is to avoid the need to pipe find to sort, by doing the sort directly in memory.

Usage

find-sort [options] <dir> [<dir> ...]

Options

  • -depth int - Maximum recursion depth (-1 for unlimited, 0 for non-recursive) (default: -1)
  • -ignore-dot - Ignore entries starting with . (default: true)
  • -l, --long - Use long output format (equivalent to --output=long)
  • -order string - Sort order: asc, desc (default: asc)
  • -output string - Output style: path, long, size (default: path)
  • -size string - Size format: human, integer (default: human)
  • -sort string - Sort key: name, size, mtime, path (default: mtime)
  • -type string - Entry type: file, dir, all (default: all)

Examples

# Find the last modified file recursively (default behavior)
./find-sort . | tail -1

# Find the last modified file in the current directory only (non-recursive)
./find-sort --depth=0 . | tail -1

# Find files up to 2 levels deep
./find-sort --depth=2 . | tail -1

# Find the last modified file in the last 10 modified directories
./find-sort $(find-sort --type=dirs | tail -10) | tail -1

# Recursively list all files sorted by size (largest first)
./find-sort --sort=size --order=desc .

# Show long output with human-readable sizes (default)
./find-sort -l .

# Show long output with integer sizes
./find-sort -l --size=integer .

# Show size output with human-readable format
./find-sort --output=size .

# Show size output with integer format
./find-sort --output=size --size=integer .

# List only directories, sorted by name
./find-sort --type=dir --sort=name .

# Include hidden files/directories
./find-sort --ignore-dot=false .

# List only immediate subdirectories (depth 1)
./find-sort --depth=1 --type=dir .

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages