mv *.new *.oldWrong !
That outputs a series of mv commands, one per file, and pipes them to a shell. The quotes help make sure thataren't touched by the shell - this isn't always needed, but it's a good idea if you aren't sure what files you'll be renaming:
mv 'afile.new' 'afile.old' mv 'bfile.new' 'bfile.old' ...
(To see the commands that will be generated rather than executing
them, leave off the
To copy, change
For safety, use
mv -i or
cp -i if your versions have
This method works for any UNIX command that takes a pair of filenames. For instance, to compare a set of files in the current directory with the original files in the /usr/local/src directory, use:
ls -d *.c *.h | sed 's@.*@diff -c & /usr/local/src/&@' | sh