title: Backing up folder using Powershell Copy-Item cmdlet
body: <p>I want to backup all files on a volume that have changed in the past 24 hours. I want the backup folder to keep the folder structure of the original. I find that when I test my current script, the folders are all placed in root.</p>
  
  <pre><code>$today = Get-Date -UFormat "%Y-%m-%d"
  
  $storage="D:\"
  $backups="E:\"
  $thisbackup = $backups+$today
  
  New-Item -ItemType Directory -Force -Path $thisbackup
  foreach ($f in Get-ChildItem $storage -recurse)
  {
      if ($f.LastWriteTime -lt ($(Get-Date).AddDays(-1)))
      {
          Copy-Item $f.FullName -Destination $thisbackup -Recurse
      }
  }
  Write-Host "The backup is complete"
  </code></pre>
  
  <p>It also seems to be copying ALL files in these folders.</p>
  
  <p>Can I get some assistance on this?</p>