Copy-Item : Cannot find path 'C:\Pumpmate Fuel Management\PB.MDB' because it does not exist

22 views Asked by At

I'm trying to run a powershell command where it makes a copy of the file "PB.mdb" in a specific location, renames it with a timestamp at the end of it, and saves it in a different location.

Here is my code:

$sourcePath = "C:\Pumpmate Fuel Management\PB.MDB"
$destinationPath = "C:Temp\TEST\PM - Backups\"
$timestamp = Get-Date -Format "yyyyMMddHHmmss"
Copy-Item $sourcePath $destinationPath
Rename-Item "$destinationPath\PB.MDB" "PB_$timestamp.MDB"

When I run it, I get this outcome: Copy-Item: Cannot find path C:Pumpmate Fuel ManagementPB.MDB because it does not exist.

Please assist.

Kind Regards, Gaston

0

There are 0 answers