Skip to content

Instantly share code, notes, and snippets.

@namgk
Created January 11, 2019 20:37
Show Gist options
  • Save namgk/ae9cfff511921ab9cc8f4532622ab5f9 to your computer and use it in GitHub Desktop.
Save namgk/ae9cfff511921ab9cc8f4532622ab5f9 to your computer and use it in GitHub Desktop.
Shell script: remove spaces from file name
#!/bin/bash
if [[ $# -eq 0 ]]; then
echo "Usage: ./shitspace.sh <folder where spacy files located>"
exit 1
fi
cd $1
for oldname in *
do
newname=`echo $oldname | sed -e 's/ /_/g'`
mv "$oldname" "$newname"
done
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment