Question

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.

Was it helpful?

Solution

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;  
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top