title: Find specific files by date modified and copy to the relevant folder
body: <p>I'm looking for a PowerShell script which can find the files (<code>N30008xx.txt</code>, <code>N30005xx.txt</code>) from the source directory and copy them to the destination directory by creating a folder with the same name of the file's modification date.</p>
  
  <p>I'm able to run the below script which creates the folder by files modified date.</p>
  
  <pre><code>$p = "Filesourcepath"
  
  Get-ChildItem -Path $p |
      Where-Object { ! ($_.PSIsContainer) } | 
      ForEach-Object {
          $newDir = Join-Path $p ($_.LastWriteTime).ToString("yyyy-MM-dd")
          New-Item -Path $newDir -ItemType Directory -ErrorAction SilentlyContinue
          $_ | Move-Item -Destination $newDir
      }
  </code></pre>