I made this applescript droplet earlier today to do something similar - its abit sloppy and comes with no guarantees, but it should work.
on open (daFile)
-- define variables
set daFile to daFile as string
set daPath to "" as string
set badChar to {space, "'", "\"", "*", "?", "[",} --...