I need to copy all of my c:\inetpub directory to a new location but exclude the following folders and their subfolders
c:\inetpub\custerr c:\inetpub\history c:\inetpub\logs c:\inetpub\temp c:\inetpub\wwwroot
So far I am doing this can someone help please?
# Directory name is created with a format string$dirName = "\\servername\folder1 _ {0}\inetpub" -f (get-date).ToString("yyyy-MM-dd-hh-mm-ss")
$dirName # Check the output
# Create dir if needed
if(-not (test-path $dirName)) {
md $dirName | out-null
} else {
write-host "$dirName already exists!"
}
# Copy Backup File to Dir
Copy-Item "\\servername\c$\inetpub\*" $dirName -recurse