Introduction

This is the easiest way I’ve found to replace spaces in file names with another character for example underscore.

Solution

At a bash prompt, use rename:

find -name "* *" -type d | rename 's/ /_/g'    # do the directories first
find -name "* *" -type f | rename 's/ /_/g'

This does the trick nicely.

Bulk Replace Spaces in File Names
Tagged on:     

Leave a Reply

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

Time limit is exhausted. Please reload CAPTCHA.

Optimization WordPress Plugins & Solutions by W3 EDGE