Using P4V, you can right click on a folder and select “Reconcile Offline Work…”. In the middle panel (“Local files not in depot”), all the files that Perforce can find in the folder tree that are not in the depot will be listed. You can select some or all of these and right click and select “Delete Local File”
This isn’t a script, but it’s much easier than most other solutions on Windows.