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 --dry-run

Review the output, remove --dry-run, and run it again when you are ready.

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

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.
--dry-runPreview without writing files.

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,
  dryRun: true,
});

Related guides