if you have space(s) in the path, you must either escape the space(s) or put the whole path into quotes.
Oddly the rm command with a wildcard (e.g. /Users/Desktop/Test/*) doesn’t work on my machine,
if the path is quoted, so the following script uses a repeat loop:
Caution: executing the script deletes permanently the contents of the chosen folder
set theFolder to (choose folder)
tell application "Finder" to set theItems to (get items of theFolder)
repeat with i in theItems
do shell script "rm -rf " & quoted form of POSIX path of (i as alias)
end repeat
You can add the asterik on to the end, after the rest of the path has been quoted.
Caution: This script deletes files!
choose folder with prompt "Delete contents of this folder:"
set targetFolder to POSIX path of result
do shell script "/bin/rm -r " & quoted form of targetFolder & "*"