Remove whitespaces from filenames in Linux [closed] Remove whitespaces from filenames in Linux [closed] linux linux

Remove whitespaces from filenames in Linux [closed]


The following would work in case it was really a space.

$ rename "s/ //g" *

Try

$ rename "s/\s+//g" *

\s is a whitespace character, belonging to the set of [ \t\r\n].


You could do something like this:

IFS="\n"for file in *.jpg;do    mv "$file" "${file//[[:space:]]}"done