The issue is that List files in folder returns both files and folders that are contained in that folder - so when you loop over the results, you're deleting both files and folders at the top-level which would effectively delete everything in the folders you deleted.
When you use Get files and Get items in SharePoint, they also return both files/items and folders.
To resolve your issue, there is a property that's also returned for each item called IsFolder which is set to true or false depending on whether it's a folder or file. You can check this property, and only delete the item if IsFolder is false.

----------------------------------------------------------------------
If I've answered your question, please mark the post as Solved.
If you like my response, please consider giving it a Thumbs Up.