My goal is to create a Powershell program that excludes a certain folder, in this example, titled "ExcludeFolder" along with every file in each folder. I only want to copy the folder structure.
I could have folders like this:
//fileshare/src/client/01/IncludeFolder3
//fileshare/src/client/101/ExcludeFolder
My code looks something like this:
$srcparent = "//fileshare/src/client"
$dstparent = "//fileshare/dst/client"
Copy-Item $srcparent $dstparent -Recurse -Force -Exclude "ExcludeFolder", "*.*"
When I run my code, it does two things: it doesn't copy the files over (which is what I want), but it does copy "ExcludeFolder" over for each client (which is not what I want).
My goal is to create a Powershell program that excludes a certain folder, in this example, titled "ExcludeFolder" along with every file in each folder. I only want to copy the folder structure.
I could have folders like this:
//fileshare/src/client/01/IncludeFolder3
//fileshare/src/client/101/ExcludeFolder
My code looks something like this:
$srcparent = "//fileshare/src/client"
$dstparent = "//fileshare/dst/client"
Copy-Item $srcparent $dstparent -Recurse -Force -Exclude "ExcludeFolder", "*.*"
When I run my code, it does two things: it doesn't copy the files over (which is what I want), but it does copy "ExcludeFolder" over for each client (which is not what I want).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.