Skip to main content
edited in `IFS` and `-r`
Source Link
Michael Krelin - hacker
  • 141.8k
  • 24
  • 197
  • 175
find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -depth -name '* *' \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -depth -name '* *' \
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -depth -name '* *' -depth \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -name '* *' -depth \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -depth -name '* *' \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

deleted 3 characters in body
Source Link
Michael Krelin - hacker
  • 141.8k
  • 24
  • 197
  • 175
find . -name '* *' | sort -rdepth \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -name '* *' | sort -r \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

find . -name '* *' -depth \
| while read f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

failed to get it right at first, because I didn't think of directories.

Post Undeleted by Michael Krelin - hacker
added note
Source Link
Michael Krelin - hacker
  • 141.8k
  • 24
  • 197
  • 175
Loading
Post Deleted by Michael Krelin - hacker
Source Link
Michael Krelin - hacker
  • 141.8k
  • 24
  • 197
  • 175
Loading