3 ms·
find --name *.txt --exec mv {} {}.bak\; That's imperfect because find doesn't provide a nice way to do the pattern-replacement but it's a pretty simple pattern
by sukilot 10y ago
find --name *.txt --exec mv {} {}.bak\;
That's imperfect because find doesn't provide a nice way to do the pattern-replacement but it's a pretty simple pattern.
If this use case were important, it's simple enough to write a purpose-built program that generated command-line argument pairs according to a spec.
- Asooka 10y agoI would probably do find -name '*.txt' -exec bash -c 'mv -nv "$0" "${0/.txt/.bak}"' {} \; That's not at all user-friendly, but these are supposed to be programmer tools... If you want user-friendly file operations on UNIX command line, use midnight commander. It can do mass rename, etc.