I wrote a little bash script to replace all the underscores in a filename with spaces, in the current directory.
Here it is:
#!/bin/bash
#this script renames all filenames containing _ with [space], in the current directory
#copy to /usr/local/bin and set permission as +x
total=`ls | grep .*_.* | wc -l`
count=0
while [ $count -lt $total ]
do
filename=`ls | grep .*_.* | head -1`
newfilename=`ls | grep .*_.* | head -1 | tr '_' ' '`
mv "$filename" "$newfilename"
echo "renamed $filename to $newfilename"
count=`expr $count + 1`
done
No comments:
Post a Comment