Heath Raftery <hraftery@myrealbox.com> wrote:
chext () {
local file newext
newext=$1
shift
for file in $argv
do
mv $file $(echo $file(:r)).${newext#.}
done
}
Call as: chext .jpg *
Will that work in most shells with 5000 files? I'd be expecting a 'argument list too long' error. Or is that up to the command to decide?
No, argument list length is up to the shell, not the command. The above is written for zsh, and will probably not work in any other shell.
Sysop: | Gate Keeper |
---|---|
Location: | Shelby, NC |
Users: | 713 |
Nodes: | 20 (0 / 20) |
Uptime: | 00:12:09 |
Calls: | 9,019 |
Calls today: | 7 |
Files: | 5,288 |
D/L today: |
207 files (56,620K bytes) |
Messages: | 464,260 |
Posted today: | 2 |