I am trying to copy a folder from one place to a network place. But I want to exclude some folder from being copied.
:: time and date stamp YYYYMMDD, HHMMSS and YYYY-MM-DD_HH-MM-SS
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set dt=%%a
set datestamp=%dt:~0,8%
set timestamp=%dt:~8,6%
set YYYY=%dt:~0,4%
set MM=%dt:~4,2%
set DD=%dt:~6,2%
set HH=%dt:~8,2%
set Min=%dt:~10,2%
set Sec=%dt:~12,2%
set stamp=%YYYY%-%MM%-%DD%T%HH%-%Min%-%Sec%
mkdir "\\serv1\b$\Script Backup\%stamp%"
XCOPY C:\source "\\serv1\b$\Script Backup\%stamp%" /S
this xcopy command will copy the entire C:\source over to the network location. but I want to exclude the following directores that are currently inside C:\source
I want to exclude the following folders
C:\source\dba
C:\source\staging
C:\source\testing
How can I do that?