title: PowerShell Move Old Files with folder structure
body: <p>I'm working with PowerShell and need to move all older files than x days to another folder, like this:</p>
  
  <pre><code>Get-ChildItem -Path $filepath -Recurse |
    Where-Object {$_.LastWriteTime -lt (Get-date).AddDays(-$daystoarchive)} |
    Move-Item -destination $filearchivepath
  </code></pre>
  
  <p>But the problem is, that the folder structure is gone, when im adding "AddDays(-$daystoarchive)".</p>
  
  <p>So how can i achieve this?</p>