I need to make copy of folder with subfolders, but do it without any files, except data that include folder “Project”.
So I need to do new folders tree, but it should include only files that was present in subfolder named “Project”.
ok, My solution:
$folder = dir D:\ -r
$folder
foreach ($f in $folder)
{
switch ($f.name)
{
"project"
{
Copy-Item -i *.* $f.FullName D:\test2
}
default
{
Copy-Item -exclude *.* $f.FullName D:\test2
}
}
}
Another solution: