I want to delete all files in my camera using ptpcam.exe. What i'm doing is first executing the command ptpcam -D (which is used to delete all files in camera).
I will try to answer your question, but this thread is about chdkptp
https://www.assembla.com/spaces/chdkptp/wiki not ptpcam.
ptpcam -D uses standard PTP commands, not CHDK extension commands. I haven't tested this or looked at how it works, but sometimes using standard commands change the state of the camera.
You can delete files using the CHDK extension by sending calling os.remove() in lua.
In chdkptp, the rm command does this for you. You could use rm -skip_topdirs DCIM to delete all image.
But in case I have more then 1 files (yes only 1) to be deleted, camera hangs and doesn't recognize any command succeeding ptpcam -D.
Does this only happen when you try to reboot, or if you use ptpcam -D by itself?
Reboot can sometimes have problems to. I would suggest making sure the camera is in playback mode and has retracted the lens before you call it. Also, if you delete all images and reboot, the file counter may not be saved, meaning when you take more images they will have the same numbers as ones you took before.