Your question is not very clear, but assuming you mean the filenames have leading whitespace, then you want to loop through each filename, and if it has leading whitespace rename it.
Since the new name might exist, you have to check for that, too.
#!/bin/bash
# rename files with leading whitespace.
# append [1], [2], and so forth, if the new name exists, until an unused name is found.
rename_file() {
local old="$1" new="$2" count=1
if [[ ! -e "${new}" ]]; then
mv -v "${old}" "${new}"
else
while [[ -e "${new} [${count}]" ]]; do
count=$((count + 1))
[[ "${count}" -gt 100 ]] && exit 9 # make sure we don't accidentally loop forever...
done
mv -v "${old}" "${new} [${count}]"
fi
}
[[ -n "$1" ]] && cd "$1"
/bin/ls -1 . | grep $'^[ \t]' | while read file; do
newname="$(echo "${file}" | sed -i -e 's/^[[:space:]]*//')"
rename_file "${file}" "${newname}"
done
That should do the trick.
Run it while in the correct directory, or give it a directory as an argument.