I am trying to compare 2 directories ( A / B ) in Linux and DELETE any files from B which DO NOT exist in A.
For example, if file '1.jpg' exists in Directory B but does not exist in Directory A then it needs to be deleted from B.
I have tried using diff but all the files are essentially different so it doesn't seem to work. (They are thumbnails of different sizes but have the same id's). So, this has to be done by file name only and ignore the actual contents of the file.
Can someone please shed some light on how to do this with minimal effort?