Node.js CLI

Rename and organize media from the command line

The Foldnize CLI reads original dates from EXIF, QuickTime, and other metadata. Preview every operation with --dry-run, then run the same command to apply it.

Quick start

Node.js 22 or newer is required. Run the CLI without a global installation:

npx foldnize --root=./photos --mode=replace --limit=50 --dry-run

Review the output, remove --dry-run, and run it again when you are ready. Foldnize processes at most 50 files by default; pass --limit=-1 only when you intentionally want no limit.

Common commands

Prefix the original filename with its EXIF date

npx foldnize --root=./photos --mode=prefix --dry-run

Replace filenames and create Year/Month folders

npx foldnize --root=./photos --mode=replace --year-month --dry-run

Add a descriptive custom name

npx foldnize --root=./photos --mode=custom \
  --custom-name=vacation --year-month --dry-run

Add RAW and GIF to the default formats

npx foldnize --root=./photos --extensions=raw,gif --dry-run

Process only RAW files

npx foldnize --root=./photos --extensions=raw --extension-mode=only --dry-run

CLI options

OptionPurpose
--root=PATHFolder to scan; defaults to the current folder.
--mode=MODEUse prefix, replace, or custom naming.
--custom-name=NAMEName used by custom mode.
--year-monthMove files into YYYY/MM/.
--no-subfoldersScan only the top level.
--limit=NUMBERProcess and count 1–1000 files; defaults to 50. Use -1 for unlimited.
--extensions=LISTComma-separated custom extensions. A list defaults to extending built-in formats.
--extension-mode=MODEUse default, only, or extend.
--dry-runPreview without writing files; the same file limit applies.

Use Foldnize as a TypeScript library

npm install foldnize
import { organizeFolder, Mode } from "foldnize";

organizeFolder({
  root: "/Users/you/Pictures",
  mode: Mode.REPLACE,
  organizeIntoYearMonth: true,
  scanSubfolders: true,
  maxFiles: 50, // 1–1000; -1 = unlimited
  extensionFilter: { mode: "extend", extensions: ["raw", "gif"] },
  dryRun: true,
});

Related guides