Remove spaces from files

find . -name ‘* *’ | while read file;
do
target=`echo “$file” | sed ‘s/ /_/g’`;
echo “Renaming ‘$file’ to ‘$target'”;
mv “$file” “$target”;
done

This entry was posted in Linux and tagged . Bookmark the permalink.

One Response to Remove spaces from files

  1. carolgee says:

    “Krojamsoft BatchRename” Tool is a powerful tool, that allows you to quickly rename all the files in a specified directory. You can remove spaces, replace spaces with underscore, uppercase/lowercase filename, add a prefix/suffix, remove/replace strings and also catalog files by adding an incremental number to the file name.

Leave a Reply

Your email address will not be published. Required fields are marked *