[How2Tips] How to change several filenames with vim?

Want to change several filenames in one row? Know how to use vim? Here’s how you could do it:

  • You’ll need the vidir utility, get it by installing the moreutils package (on Debian/Ubuntu: sudo apt-get install moreutils)
  • Run vidir <dirpath> (dirpath defaults to the current directory), and you’ll get a list of all the files in the target directory (non-recursively)

You can now edit filenames, and you’re actually in vim now, so you can even use regexp find/replace, and you must save your changes with the :w command. That’s all!

Want to edit filenames recursively?

find . -type f | vidir - should do the job.

This article is from our internal knowledge base, we wanted to share it with you. ❤ Send us a KUDO-Tweet if this article has helped you !