![]() Rollback | restore to original file names in target folder. Node batchRename.mjs -n odd -t -a CUSTOM_TEXT -textPosition append Preview the odd numbering transform with custom text append in a target folder. Node batchRename.mjs -d -separator _ -targetType all Node batchRename.mjs -n -exclude 'excludedName' -b 100 'folder'Īppend creation date to files AND folders in the current folder and specify a custom separator. Preview numeric transform with exclude option and a custom baseIndex. Preview rename files by keeping only part of the name (the 'id-' tag with variable number of digits). Rename files using a search and replace algorithm. As a standalone script: Execute npm run build or npx webpack which will bundle the application into a single standalone bundle in the prod folder, called batchRename.mjs.Alternatively, you can also transpile the code directly via npx ts-node src/index.ts. Run the script inside the project folder by executing npm run compile and node dist/index.js with appropriate options.Then run node /path-to-your-file/batchRename.mjs with the appropriate option.Ĭlone the repo, then run npm install. Preferred: Download the production version of the script in the Releases subpage.Safety features: In addition to the built-in rollback functionality, the script also strives to prevent duplicate transforms that would result in file overwrites from happening.The rollback logic also gracefully handles failed restore operations (for example, because of file locks), by re-adding them to the rollback file as the most recent transformation available for restore.This means multiple transforms on existing / newly added files can be made and rolled back. Multi level rollback: By default, each transform operation will create or update a rollback file in the target directory with a history of all transforms.The cleanRollbackFile utility option is a current exception: it will run immediately, without confirm prompt.Results preview: All transform operation run in dryRun mode by default so they can be previewed and executed only upon explicit confirmation. ![]() Lightweight: Compiled script comes in at just over 61 KB.Some transformations (in particular addText, truncate, and format) may be combined to produce a compound effect. Transforms can be directed at base names only (default), just extensions, or the whole name. Flexible operation: You can target files (default), directories, or both.A variety of transform operations: Search and replace variants, numeric and date transforms, truncate, add text and format transforms.A lean, no nonsense Node.js utility for batch file renaming with rollback support.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |