I have a Powershell script that moves files:
$from = $path + '\' + $_.substring(8)
$to = $quarantaine + '\' + $_.substring(8)
Move-Item $from $to
The directory structure in the $to path doesn't exist so I would like Powershell to create it with Move-Item. I've tried adding -Force but that didn't work.
What can I do to make sure Powershell creates the needed directories in $to?