# Change suffix



## Matsaki (Aug 26, 2008)

How do I change the suffix .JPG to .jpg in the terminal / UNIX ?


----------



## macbri (Aug 26, 2008)

For one file or many?

One file:

```
mv somefile.JPG somefile.jpg
```

Many files in one place (using bash):

```
for file in *.JPG; do mv $file ${file%.*}.jpg; done
```

Many files in many directories below the current directory (using bash):

```
for file in $(find . -name \*.JPG -print); do mv $file ${file%.*}.jpg; done
```

Since "mv" doesn't care to ask your permission, it'll happily overwrite files if it needs to.  So use with caution.


----------



## Matsaki (Aug 27, 2008)

Many thanks! It was 12.000 files and made my life easier


----------

