linux delete files in folders without deleting the folder

C++
find /path/to/directory -type f -exec rm -iv {} \;

Source

Also in C++: