title: How to copy a file to other directory sort by first received using PowerShell?
body: <p>I have some file in a folder, I want to copy one file which is the first received.</p>
  <pre><code>$Sel_JobFolder = &quot;D:\Testing&quot;
  $PickJob = Get-ChildItem -Path &quot;$Sel_JobFolder\*.que&quot; | Sort-Object LastWriteTime
  $count = 1
  $GetJob = Get-Random -InputObject $PickJob -Count $count
  Write-Output &quot;Selected Job: $GetJob&quot;
  </code></pre>
  <p>copy-Item $GetJob -Destination &quot;C:\File&quot;</p>
  <h3>Updated</h3>
  <p>This what I need, and It works</p>
  <pre><code>$PickJobs = @(Get-ChildItem &quot;$Sel_JobFolder\*.que&quot; | Sort LastWriteTime)[0] | % { Copy-Item -path $_.FullName -destination $(&quot;C:\Process&quot;) -force}
  </code></pre>