title: Get-Childitem unknown "ReadError"
body: <p>I need some help with solving one thing.</p>
  <p>I have a script in place which collects logs from different folders. It was working well for a few months but today I found that it fails at GCI when reading some folder.</p>
  <p>Here is the code.</p>
  <pre><code>Function Process-Logs {
  
    Param (
      [Parameter(Mandatory=$True)]
       [string] $Area
    )
  
    $PathFailed  = &quot;P:\IntegrationFileShare\failed\$Area&quot;
    $PathLogs    = &quot;P:\IntegrationFileShare\logs\$Area&quot;
    
    #$Dest = &quot;C:\tmp\SCRPT\&quot;
    $Dest = 'C:\tmp\SCRPT\' +$Area + '\'
    
    $compress_log = @{
      Path             = $Dest + '*.log'
      CompressionLevel = &quot;Fastest&quot;
      DestinationPath  = ($Dest + &quot;Logs_&quot; + ($Area) + &quot;_&quot; + ($Date) + &quot;.zip&quot;)
    }
    $compress_failed = @{
      Path             = $Dest + '*.log'
      CompressionLevel = &quot;Fastest&quot;
      DestinationPath  = ($Dest + &quot;Failed_&quot; + ($Area) + &quot;_&quot; + ($Date) + &quot;.zip&quot;)
    }
    
    gci -path $PathLogs -filter *$Date* | %{cp $_.pspath -destination $Dest}
    if(Test-Path $compress_log.Path) {Compress-Archive @compress_log}
    Remove-Item -Path $Dest* -Include *.log
    
    gci -path $PathFailed -filter *$Date* | 
      %{cp $_.pspath -destination $Dest}
    if(Test-Path $compress_failed.Path) {Compress-Archive @compress_failed}
    Remove-Item -Path $Dest* -Include *.log
  
  } #End Process-Logs
  
  $Date = (get-date).AddDays(-1).ToString(&quot;yyyy-MM-dd&quot;)
  #$Date = &quot;2021-03-28&quot;
  Process-Logs -Area &quot;Europe&quot;
  Process-Logs -Area &quot;LATAM&quot;
  Process-Logs -Area &quot;APAC&quot;
  Upload-Files
  </code></pre>
  <p>For some reason, I got this error for LatAm all the time and Europe sometimes when I run full script.</p>
  <pre><code>gci : The specified server cannot perform the requested operation.
  At C:\tmp\SCRPT\LogDownloader_PROD_Sched.ps1:25 char:3
  +   gci -path $PathLogs -filter *$Date* | %{cp $_.pspath -destination $ ...
  +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ReadError: (P:\IntegrationFileShare\logs\LATAM:String) [Get-ChildItem], IOException
      + FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand
  </code></pre>
  <p>When I removed -Recurse from GCI it started to work for Europe. That made me think that maybe there is a file or folder in depth which I cannot read as I am not an admin. But the same line of Code works for each Area and now it works for EU and APAC but fails all the time for LatAm.</p>
  <p>When I go to this folder with Explorer I have not any problem and can move copy/move/delete files.
  Also, I did Powershell-&gt;CD LatAm folder and did GCI with filter - it works.
  When I run script operation by operation GCI works.</p>
  <p>It fails only when I run the full script.
  Can someone tell me what I'm missing here?</p>
  <p>Thanks in advance.</p>