Some Linux tools does not properly work with files which include spaces in their names. This simple bash for loop will remove white space from file names and rename/move for all files in the given directory.

First enter directory with cd:

cd /my/directory

and then run:

for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Go to top