I wrote a shell script to remove the files from the moodledata directory simply by doing
select concat("rm -f ",substr(contenthash,1,2),"/",substr(contenthash,3,2),"/",contenthash)
from mdl_files where component="backup" and filearea="automated"
This generated a list of files with the deletion command,
which I could then save as a .sh file and execute.