After the foreclosure sale, you will receive an eviction notice which will mention the time period within which you will have to leave the property.
I agree with Adonis. The eviction notice will mention the time period within which you will have to leave to the property. The time period may vary from 3 days to 30 days as per the discretion of the new buyer and the lender.
thank you for your answer. I had read somewhere that in New York tenants are allowed to stay 90 days or longer if they have a signed lease