Copy-Item from csv fail when directory name include dot

Welcome Forums General PowerShell Q&A Copy-Item from csv fail when directory name include dot

  • This topic has 1 reply, 2 voices, and was last updated 7 months ago by
    Participant
    .
Viewing 1 reply thread
  • Author
    Posts
    • #185783
      Participant
      Topics: 1
      Replies: 0
      Points: 12
      Rank: Member

      Hi community,

      I am trying to copy multiple files from a CSV file, running the script generates the following error.

      Copy-Item : No se puede encontrar una parte de la ruta de acceso ‘D:\OneDrive\My Company Seguros\riesgos – Documentos\08. Control
      Gesti�n Corresponsales\2019\VIDEO TOP 10\TOP 10 2019 Riesgos 5 def.mp4’.

      The file CSV contain the next structure.

      Source, Dest

      D:\SPS2007\Riesgos\TOP 10 2019 Riesgos 5 def.mp4,D:\OneDrive\My Company Seguros\riesgos – Documentos\08. Control Gestión Corresponsales\2019\VIDEO TOP 10\TOP 10 2019 Riesgos 5 def.mp4

      Where the source and dest values path are:

      Source: D:\SPS2007\Riesgos\TOP 10 2019 Riesgos 5 def.mp4

      Dest: D:\OneDrive\My Company Seguros\riesgos – Documentos\08. Control Gestión Corresponsales\2019\VIDEO TOP 10\TOP 10 2019 Riesgos 5 def.mp4

      This is the script I use.

      Import-Csv D:\SPS2007\Riesgos\TestTranscriptFile.csv -Delimiter “,”  | foreach {Copy-Item -Path $_.Source -Destination $_.Dest}

    • #185798
      Participant
      Topics: 4
      Replies: 2238
      Points: 5,447
      Helping Hand
      Rank: Community MVP

      Are you sure it’s about the dot in the path of folder? The destination folder has to exist before you’re able to copy something into it.

Viewing 1 reply thread
  • The topic ‘Copy-Item from csv fail when directory name include dot’ is closed to new replies.