Question: I have a directory "FolderName" with 10,000 new files every day. Almost a half of those files are named as follows:

```
filename_yyyy-mm-dd_hh:mm

```

while the other half are named:

```
filename_yyyy-mm-dd hh:mm

```

(with space instead of underscore)

The script I'd like to set up should do the following:

Rename only the files containing a space in their name, skipping files that need no processing.

I cannot find a way to make the script efficient, I need to really skip the good half, my script tries to mv any file, and it's quite long and inefficient. Any good idea for a better design?

Thanks everybody

Answer: 
with the legacy `rename` you can easily convert single space to underlines

```
$ rename ' ' '_' files

```
Rename only the files containing a space in their name, skipping files that need no processing:

```
for file in *\ * ; do mv "$file" "${file// /_}" ; done

```

Move all the files older than one week to a "NewFolderName" folder:

```
find -mtime 7 -exec mv {} NewFolderName/ \;

```