You need to check REQUEST_URI for the folder name you do not want to redirect. If the REQUEST_URI contains the folder name, do not redirect.
You can put the following code in the .htaccess file of your old domain if you do not want a redirection for folder1 and folder2. The following code redirect pages to the "https://www." version. You can edit it as per your settings. Also, if you are not willing to do the permanent redirection, you can use 302 in place of 301.
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(folder1|folder2)/
RewriteRule ^(.*)$ https:/ /www.newdomain.com/$1 [R=301,L]