Automatically download the attachment in a holding folder, then immediately have an if statement based on the email subject, where if email subject does or does not meet your criteria, loop through holding folder and delete your attachments & continue in the 'for each email in server' loop.
If an email is sent with the subject you desire, it will pass the above logic and you can have a command to copy the attachment in your desired folder location and delete it from the holding folder.
This will ensure you only get the attachments that pass the criteria/logic you set up in the code.