How can I remove leading/trailing whitespace from filenames in Automator?
There's one line script for that, cd to that folder and ...  

for f in *; do mv "$f" "$(echo $f)"; done


Put it into a shell script and call it from Applescript:

tell application "Terminal"
    do script "whatever"
end tell