I want to delete particular mp3 files in a directory that has no metadata(Title, artist, etc). I tried sorting the files and then deleting it manually but it didn't work as the number of files is huge(~30K). Is there any python script to accomplish this task?
This example script is not completed, but I hope that good start point for you.
import os
import glob
from mutagen.easyid3 import EasyID3
mp3_files_list = glob.glob(path/to/your/mp3-files-folder/*.mp3) # example path /home/user/Downloads/mp3/*.mp3
for mp3_file in mp3_files_list:
audio = EasyID3(mp3_file)
if not audio['title']: # if title tag is empty
os.remove(mp3_file)
if not audio['artist']:
os.remove(mp3_file)
# etc tags check
Mutagen module documentation: https://mutagen.readthedocs.io/en/latest/