Use robocopy to exclude directories containing a file

I tested this and it worked for me:

@echo off
echo.
set /p "Source=Please specify the source folder: "
echo.
set /p "Destination=Please specify the destination folder: "
echo.

set "Source=%Source:"=%"
set "Destination=%Destination:"=%"

pushd "%Source%"

for /f "delims=" %%a in ('dir /b /s /a ^|find /i ".nosync"') do echo %%~dpa>>"%~dp0nocopy.txt"

popd

xcopy "%Source%" "%Destination%" /e /h /r /exclude:nocopy.txt
del /q nocopy.txt