I cant figure out what I am doing wrong with this command and would like another set of eyes to point it out.
I want to copy the directory structure but not the files the structure contains.
Copy-Item -recurse -exclude *.* -path \\server1\z$\backups\ -destination \\server2\z$\ -Verbose
The command runs but it copys files despite telling it not to copy files. How do i copy the directory tree and not the files?
Try this.
copy-item -path "\\server1\z$\backups\" -Destination "\\server2\z$\" -Filter {$_.PSIsContainer -eq $True} -recurse
Sorry, that didn't really answer your question. Maybe try something like this:
That above PS script probably needs some tweaking -- I did not really test it. But the concept is there.
This is what I came up with. You can take out the "mkdir" command to test before running it.