---
title: "Update filenames removing ampersand"
date: "2010-07-01"
path: "/56-update-filenames-removing-ampersand.html"
section: "/ramblings"
aliases:
  - "/56"
  - "/56-update-filenames-removing-ampersand"
  - "/56.html"
  - "/blog/updatefilenamesremovingampersand"
  - "/ramblings/56-update-filenames-removing-ampersand.html"
---

This is quite useful script (I named it fix.sh) for removing unsupported characters from file names:

```
ls -1 | while read file
do
target=$(echo $file | sed -e "s/\&/_/")
mv "$file" "$target"
done
```

In particular, this removes "&" from filenames and replaces with underscore (\_) using sed - very useful
