Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell rename-item reports both dirs have the same name

$
0
0
Hi guys,

I have a simple script to rename folders which is not working as expected.

I have 2 variables for this specefic example

    $fullpath = "\\SERVER\files\Operations\RELATIES\Klanten\11143 - Hotel-Caf-Restaurant De Biltsche Hoek Exploitatie B.V"
    $mf = "\\SERVER\files\Operations\RELATIES\Klanten\11143 - Hotel-Caf-Restaurant De Biltsche Hoek Exploitatie B.V."

And the actual command:

    Rename-Item -Path $fullpath -NewName $MF -Verbose

and i get this back

    VERBOSE: Performing operation "Rename Directory" on Target "Item:
    \\buckaroo.work\files\Operations\RELATIES\Klanten\11143 - Hotel-Caf-Restaurant De Biltsche Hoek Exploitatie B.v
    Destination: \\buckaroo.work\files\Operations\RELATIES\Klanten\11143 - Hotel-Caf-Restaurant De Biltsche Hoek Exploitatie B.V.".
    Rename-Item : Source and destination path must be different.
    At line:1 char:12
    + Rename-Item <<<<  -Path $fullpath -NewName $MF -Verbose
        + CategoryInfo          : WriteError: (\\buckaroo.work...Exploitatie B.v:String) [Rename-Item], IOException
        + FullyQualifiedErrorId : RenameItemIOError,Microsoft.PowerShell.Commands.RenameItemCommand


When i do a string compare i get back that they are not the same so why does the rename-item think they are?

Anyone have an idea?

Greatings

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>