rename all file with blank in directory from home root , please help me

hi ,

:wall:

I've in directory home user 3 file with blank space in name file, I would like erase the all character that no have alphanum more dot in namefile from home root , below the script.
If I execute the shell script from directory where stay it's execute well done.But I would like execute the script from home root , like so:
/var/www/html/regia0/temp/f/./ren in this case after execute the sh script erase all file in /var/www/html/regia0/temp/f/ and no rename the files, below the script work well only if I execute from the same directory where is present the hidden script. Please Help me
:wall::wall::wall:
Thanks a lot

#ren.sh
for file in *
do
mv "$file" $(echo "$file" | sed 's/[^A-Za-z0-9.]//g')
done;

---------- Post updated at 11:03 AM ---------- Previous update was at 10:41 AM ----------

ok, I'm solved It's was very simple

cd /var/www/html/regia0/temp/f  #  here the solution
for file in *
do
mv "$file" $(echo "$file" | sed 's/[^A-Za-z0-9.]//g')
done;

Thanks again at this forum

 
#!/bin/sh
 
[[ -z "$1" ]] && exit
dir="$1"

for file in ${dir}/*
do
 dr=${file%/*}
 fb=${file##*/}
 fa=${file##*/}
 echo $fa | read fa
 [[ "$file" = "$dr/$fa" ]] || mv "$file" "$dr/$fa"
done;