Remove spaces from filenames

Removing spaces from filelemanes can be archived using various methods. The command below uses sed to do this, before running it make sure you are in the folder containing the files whose names you want to change.

for file in *; do mv "$file" `echo $file | sed -e 's/  */_/g' -e 's/_-_/-/g'`; done

Leave a Reply

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