Reputation: 37
does anyone have an idea, how to copy the folder structure without any subfolders and files? i Tried with robocopy but did not find any command to exclude the subfolder.
Thank you.
Upvotes: 0
Views: 1999
Reputation: 10107
This is not the most elegant or efficient solution but it should work($destinationRoot and $sourceRoot are case sEnSitivE):
$destinationRoot = "D:\temp";
$sourceRoot = "U:\Scripts";
$dirs = ls -Attributes d -Recurse;
foreach($dir in $dirs){
$np = ($destinationRoot + $dir.FullName.replace($sourceRoot,""));
md $np -Force -ea 0;
}
Upvotes: 1