Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.
You should use the Dir library. I could explain how in more details, but i´m tired to do so, and need to test what i´m thinking on doing ^^
EDIT: Misconception! You may use File.delete(<filename>) to delete any file, just be sure to check if the file exists with FileTest.exist?(<filename>) before trying to delete.