Skip to content

Instantly share code, notes, and snippets.

@aic25
Created January 7, 2019 22:40
Show Gist options
  • Save aic25/46e942df45da666047163fb8bfb3f0c4 to your computer and use it in GitHub Desktop.
Save aic25/46e942df45da666047163fb8bfb3f0c4 to your computer and use it in GitHub Desktop.
To deal with filenames with spaces
#!/bin/bash
DIR="."
find $DIR -type f | while read file; do
if [[ "$file" = *[[:space:]]* ]]; then
mv "$file" `echo $file | tr ' ' '_'`
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment