Gmail automation help

Hi all i have to filter mail in gmail and i have to check if the attachment and also have to refine attachment and i have to check only one attachment if more than one then ignore
i have to also check the date from mail if it is yesterday than download it to other folder please help me with this.