title: psdrive path still too long
body: <p>I have to delete files older then <code>x</code> days so, knowing that we use paths longer than 260 characters, I wrote the following as a workaround:</p>
  
  <pre><code>$path= "\\very.long.path\Files\P\still\_veryLong\more_stuff\never_finish\Local\Development\really_longher_tha_260" 
  if (-not (Test-Path TEMP:)) {
      echo "Mounting virtual drive TEMP: ..."
      New-PSDrive -Name TEMP -PSProvider FileSystem -Root $path 
  }
  </code></pre>
  
  <p>Now, the problem is that even in this way, when I perform a search I've got the following:</p>
  
  <pre><code>Get-ChildItem TEMP: -Recurse -Force | Where-Object {
    !$_.PSIsContainer -and $_.CreationTime -lt $limit
  }
  </code></pre>
  
  <pre>Get-ChildItem : The specified path, file name, or both are too long.
  The fully qualified file name must be less than 260 characters, and
  the directory name must be less than 248 characters
  At C:\UserTemp\WorkStuff\jkCleanOldFiles.ps1:19 char:13
  + $allFiles = Get-ChildItem . -Recurse
  +             ~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : ReadError: (\\very.long.path\Files..lpha-9-stable- :String) 
  + Get-ChildItem], PathTooLongException
  + FullyQualifiedErrorId : irIOError,Microsoft.PowerShell.Commands.GetChildItemCommand</pre>
  
  <p>From this line:</p>
  
  <pre>+ CategoryInfo          : ReadError: (\\very.long.path\Files...lpha-9-stable- :String)</pre>
  
  <p>It looks like the path it's still starting at "\very.long.path\Files" while I would expect for it to start at "TEMP:\".</p>
  
  <p>Can someone help? What am I missing?</p>
  
  <p>EDIT: fixed using subst instead of New-PSDrive</p>