Skip to content

Instantly share code, notes, and snippets.

@goromlagche
Created February 6, 2014 08:45
Show Gist options
  • Save goromlagche/8840510 to your computer and use it in GitHub Desktop.
Save goromlagche/8840510 to your computer and use it in GitHub Desktop.
script to rename and remove space
#!/bin/bash
IFS='
'
a=0
for entry in $PWD/*.JPG
do
if [ -f $entry ]
then
filename=$(basename "$entry")
extension="${filename##*.}"
filename="${filename%.*}"
mv "$filename.JPG" "$filename.jpg"
else
echo "All JPG cleaned"
fi
done
for f in *\ *;
do
if [ -f $f ]
then
mv "$f" "${f// /_}";
else
echo "All space cleaned"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment