file renamer improvement
I decided to create a context menu for files to remove spaces or unwanted characters from the name. I use nautilus, you are able to do so by nautilus-actions package. We need the script which will run in case the menupoint is selected. If multiple files are selected, a space separated list of them will be the parameter. My script is like this
#!/usr/bin/zsh
pattern="[^a-zA-Z0-9-.]"
for (( i=1 ; i<=$# ; i+=1 ))
do
source=$*[$i]
target=${source:h}/${${source:t}//${~pattern}/_}
if [[ ! -a $target ]] then
mv "$source" "$target"
fi
done