timed out failure deleting files

I’m trying to delete around 2000 jpeg files in a folder run by an applescript on a daily basis.
The script

tell application "Finder" to delete (get files of folder inputfilepath)

gives me a timed out error however all the files were deleted.
What can I do to improve the script?

Let the shell do the job


do shell script "/bin/rm " & quoted form of POSIX path of inputfilepath & "*.jpg"

Note: the path string inputfilepath must end with a colon