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-runReview 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-runReplace filenames and create Year/Month folders
npx foldnize --root=./photos --mode=replace --year-month --dry-runAdd a descriptive custom name
npx foldnize --root=./photos --mode=custom \
--custom-name=vacation --year-month --dry-runAdd RAW and GIF to the default formats
npx foldnize --root=./photos --extensions=raw,gif --dry-runProcess only RAW files
npx foldnize --root=./photos --extensions=raw --extension-mode=only --dry-runCLI options
| Option | Purpose |
|---|---|
--root=PATH | Folder to scan; defaults to the current folder. |
--mode=MODE | Use prefix, replace, or custom naming. |
--custom-name=NAME | Name used by custom mode. |
--year-month | Move files into YYYY/MM/. |
--no-subfolders | Scan only the top level. |
--limit=NUMBER | Process and count 1–1000 files; defaults to 50. Use -1 for unlimited. |
--extensions=LIST | Comma-separated custom extensions. A list defaults to extending built-in formats. |
--extension-mode=MODE | Use default, only, or extend. |
--dry-run | Preview without writing files; the same file limit applies. |
Use Foldnize as a TypeScript library
npm install foldnizeimport { 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,
});