Renaming a List of Files Interactively

Article shows how to rename a set of files, like changing *.new to *.old. Here's a different way, done from inside vi. This gives you a chance to review and edit the commands before you run them. Here are the steps:

 & $ 
% vi Start vi without a filename :r !ls *.new Read in the list of files, one filename per line :%s/.*/mv & &/ Make mv command lines :%s/new$/old/ Change second filenames; ready to review :w !sh Run commands by writing them to a shell :q! Quit vi without saving

If you've made an alias () for ls that changes its output format, that can cause trouble here. If your alias gives more than a plain list of filenames in a column, use !/bin/ls instead of just !ls.

- JP