Background: I use a TV tuner card to capture OTA video files (.mpeg) and then my Plex Media Server automatically optimizes the files (transcodes for better playback) and places them in a new directory. I have another Plex Library pointing to the new location for the optimized .mp4 files. This results in two folders containing files with the same name except for the file extension. My goal is to run a script every x number of minutes/hours to delete the original .mpeg files if the Plex server has already optimized them. I'm familiar with crontab well enough to set the script to run periodically but cannot figure out how to create the script to compare/delete the files.
Example;
Original video files:
/mnt/Plex/DVR/Original/
episode1mmddyyyy.mpeg
episode2mmddyyyy.mpeg
episode3mmddyyyy.mpeg
Optimized video files:
/mnt/Plex/DVR/Optimized/
episode1mmddyyyy.mp4
episode2mmddyyyy.mp4
episode3mmddyyyy.mp4
The script would compare files in the two directories (minus the file extensions) and delete all files in /mnt/Plex/DVR/Original/ that match. In the example above all files in /mnt/Plex/DVR/Original/ would be deleted to save space on the hard drive.
Any insight is appreciated.