web analytics

Suppose you need to rename many files in a directory and you can’t remember any nifty way to quickly rename them. In such a case, try vidir.

All it does is creating a temporary file with the name of each file properly numbered in a separate line and loading it into the text editor, where you can edit it. Every change you make in the name or the number of a file is applied to the appropriate directory entry when you save the file.

Let’s say, for example, you want to exchange the names of two files, file1 and file2. When you run vidir, you ‘ll see something like this:

1        file1
2 file2

change it to

2        file1
1 file2

and save the file. That’s it!

Although its name implies the vi editor, don’t worry. You can use any text editor you like, as long as you declare it as your EDITOR:

$ EDITOR=kate vidir

Visit The Light of the LAMP blog for more…

Edit your directories fast

BMC logoBuy me a coffee