Skip to content

Instantly share code, notes, and snippets.

@nexus166
Last active March 17, 2020 11:41
Show Gist options
  • Select an option

  • Save nexus166/8bd81e8095dfa72352386990cb2767a2 to your computer and use it in GitHub Desktop.

Select an option

Save nexus166/8bd81e8095dfa72352386990cb2767a2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
until [[ -z "$(find ${1:-.} -name '* *')" ]]; do
find ${1:-.} -name "* *" -type d -print0 | while read -d '' f; do
mv -fv "$f" "${f// /_}";
done;
find ${1:-.} -name "* *" -type f -print0 | while read -d '' f; do
mv -fv "$f" "${f// /_}";
done;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment