# Mass rename files...?



## Jasoco (Sep 30, 2002)

Say I have a folder full of files with a .gif extension. How can I rename them all to have a .jpg extension easily?

Thanks.


----------



## roger (Sep 30, 2002)

I would use terminal to do this personally. The 'mv' command is great for this:

Type 'man mv' or check out this link for information.

R.


----------



## couzteau (Sep 30, 2002)

here is a script i wrote to kill blanks and remove some naughty chars:


> #!/bin/sh
> { for file in *; do \
> NEW=`echo $file | sed 's/ /_/g'`;
> NEW=`echo $NEW | sed 's/#26E5D//g'`;
> ...


----------



## d1taylor (Sep 30, 2002)

Try this:

```
#!/bin/sh

for filename in *.gif
do
   newfname="`echo $filename | sed 's/.gif/.jpg/'`"
   echo "renaming $filename to $newfname"
   mv $filename $newfname
done

exit 0
```
There's more we can do with this, but this'll suffice for now, I hope.


----------



## cekim (May 8, 2008)

Have you tried Renamer4Mac to batch rename your files?


----------



## artov (May 8, 2008)

for i in *.gif; do
mv $i `basename $i .gif`.jpg
done


----------

