Skip to content

An interactive file mover inspired by git

License

Notifications You must be signed in to change notification settings

robcrocombe/imv

Repository files navigation

imv (Interactive Move)

Actions Status

An interactive file renamer/mover inspired by git

Install

npm install -g imv

Usage

  1. You give imv a glob pattern of files you want to move or rename.
imv './home/*.png'
  1. It opens the list in your favorite code editor (either by the --editor param or automatically via your git config).
./home/customer.png
./home/puppy.png
./home/cat.png
  1. You make the edits you want, with the tools you already use like multiple cursors and regex.
./home-page/user.png
./home-page/puppy.png
./home-page/cat.png
  1. Save the file and close it …sounds familiar to git commit/rebase?
  2. imv will make the changes, the file on each line becomes the new file location.
  3. imv deletes the old /home directory because the directory is now empty.
  4. You're done!
Usage: imv [options] <glob>

imv -- interactive move files

Options:
  -v, --version          output the version number
  -e, --editor <editor>  use this editor to modify your file paths
  -i, --ignore <glob>    ignore files that match this glob pattern
  -g, --gitignore        ignore files that match patterns in .gitignore
  -o, --overwrite        overwrite existing files
  -t, --trash            send existing files to the trash bin
  -k, --keep-empty       keep empty affected folders after moving files
  -h, --help             output usage information

Limitations

To keep things simple, there are a few limitations:

  • It only moves files from the directory and any subdirectories where the imv command was made.
  • It cannot overwrite files that are also matched by the input glob pattern.
  • It cannot swap two file paths.

Development

You can install imv locally to develop on:

npm install
npm run dist
npm link

You can now use the imv command from your terminal. npm start will build in watch mode so you can make edits as you use the tool.

imv uses TypeScript for type safety, ESLint for linting, and Jest for testing.

About

An interactive file mover inspired by git

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published