How to do it...

Navigate to the directory where you have the files.

  1. Select only the first five files and directories from the returned list, using the First parameter.
PS> Get-ChildItem . | Select-Object -First 5
  1. Let us say you would like to pick the last five elements.
PS> Get-ChildItem . | Select-Object -Last 5
  1. To skip the first three objects:
PS> Get-ChildItem . | Select-Object -Skip 3
  1. If you would like to skip the last two objects:
PS> Get-ChildItem . | Select-Object -SkipLast 2
  1. To pick the fourth element from the output:
PS> Get-ChildItem . | Select-Object -Index 3
  1. Now, combine it with what we learnt in the previous recipe. Pick only the file names and the last modified time of the first four elements.
PS> Get-ChildItem . | select -Property Name, LastWriteTime -First 4
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.18.220.243