title: Errors in powershell script while copying
body: <p>I already spent hours on this problem, but I didn't succeed in finding a working solution.</p>
  
  <p>Here is my problem description:</p>
  
  <p>I'm a newbie in powershell, somehow I read books and made a required code but it is showing errors which i cant sort out. What the code does it fetches images from a folder and places copy of each image according to the closest available ratio (0.67,1.33,1.2) compared to the image aspect ratio in the folders(0.67,1.33,1.2) to some other location.</p>
  
  <p>My code looks more or less like this:</p>
  
  <pre><code>[System.Reflection.Assembly]::LoadFile( "C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll")  
  
  
  
  #index of minimum value
  $p = [array]::IndexOf($ratioarray, $minimum)
  
  if($p -eq 0){
  $dst_dir =  $des_dir+"powershell\0.4"
  if (!(Test-Path $dst_dir)) {
   # create it
   [void](new-item $dst_dir -itemType directory)
   }
  Copy-Item $src_dir$image $dst_dir
  }
  
  if($p -eq 1){
  $dst_dir =  $des_dir+"powershell\0.5"
  if (!(Test-Path $dst_dir)) {
   # create it
   [void](new-item $dst_dir -itemType directory)
   }
  Copy-Item $src_dir$image $dst_dir
  }
  
  if($p -eq 2){
  $dst_dir =  $des_dir+"powershell\0.67"
  if (!(Test-Path $dst_dir)) {
   # create it
   [void](new-item $dst_dir -itemType directory)
   }
  Copy-Item $src_dir$image $dst_dir
  }
  
  "$name|$width|$height|$ratioroundoff|$dst_dir" &gt;&gt; $datafile  
  
       $imageFile.Dispose() 
   }
  </code></pre>
  
  <p>It gives error:</p>
  
  <pre><code>Copy-Item : The given path's format is not supported.
  At C:\Users\busy\desktop\copyflow.ps1:71 char:10
  + Copy-Item &lt;&lt;&lt;&lt;  $src_dir$image $dst_dir
  + CategoryInfo : InvalidOperation: (C:\Users\busy\D...ics2\jack.jpg:String) [Copy-Item], NotSupportedException
  + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.CopyItemCommand 
  </code></pre>