How to use java to realize scrolling and overwriting the previous data after the hard disk is full?

java cooperated with opencv to write a small monitoring software based on usb camera under windows system.
saved on disk in the form of 8 photos per second, resulting in too many fragmented files.
it takes too long to delete using the normal delete command.
is there any way to automatically overwrite the earliest files when the hard drive is full?
or is there a quick way to delete a folder, such as directly changing the file table (not very well understood)?
Thank you

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c056-2c2f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c056-2c2f8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?