I\'m trying to copy a file to a new location, maintaining directory structure.
$source = \"c:\\some\\path\\to\\a\\file.txt\"
destination = \"c:\\a\\more\\dif
Here's a oneliner to do this. Split-Path retrieves the parent folder, New-Item creates it and then Copy-Item copies the file. Please note that the destination file will have the same filename as the source file. Also, this won't work if you need to copy multiple files to the same folder as with the second file you'll get An item with the specified name error.
Copy-Item $source -Destination (New-Item -Path (Split-Path -Path $destination) -Type Directory)