User Tools

Site Tools


docu:csheet:sysadm:script:bash:rename_spaces

Remove spaces from files in a directory recursively


Source: https://stackoverflow.com/questions/2709458/how-to-replace-spaces-in-file-names-using-a-bash-script


Install the package

apt-get install rename


Rename the dirs first, then the files

find -name "* *" -type d | rename 's/ /_/g'
find -name "* *" -type f | rename 's/ /_/g'
docu/csheet/sysadm/script/bash/rename_spaces.txt · Last modified: 2020/07/27 22:09 by admin