Reputation: 35
I have a script which backups the MongoDB database, creates an zip package and it should move this to a specified folder. But when starting Copy-Item
it throws this exception:
Copy-Item : Cannot find drive. A drive with the name '"E' does not exist.
The thing is, WinRAR, the MongoDB and the whole stuff is stored on E, the backup process works just fine, only the Copy-Item
part fails and says it cannot find E, but that's nonsense, since it can execute Programs on E...
Copy-Item -Path $archiveFile -Destination $localOneDriveFolder
$localOneDriveFolder = """E:\Project\Backups"""
$archiveFile = """E:\Program Files\MongoDB\Server\3.6\bin\backup_$x.rar"""
Upvotes: 0
Views: 3287
Reputation: 174825
Look closely at the actual error message. "E
is obviously not a valid drive identifier (notice the leading double-quote).
Remove the double-quoting:
$localOneDriveFolder = "E:\Project\Backups"
$archiveFile = "E:\Program Files\MongoDB\Server\3.6\bin\backup_$x.rar"
Copy-Item -Path $archiveFile -Destination $localOneDriveFolder
Upvotes: 1