3. File System Management Tasks - Powershell
3.1 Viewing Objects in a Directory
to view the content of a directory, use the Get-ChildItem cmdlet, and to show all hidden files, use the -Force parameter.
Get-ChildItem -Force
this will show all the files and directories in the current directory.
Get-ChildItem -Force -Recurse
this will show all the files and directories in the current directory and all subdirectories.
Get-ChildItem -Force -Recurse -Depth 1
this will show all the files and directories in the current directory and all subdirectories, but only one level deep.
Filtering the output
The script searches for all executable files (*.exe) in C:\ folder and lists only those modified after April 1, 2018.
Get-ChildItem -Path C:\ -Recurse -Include *.exe | Where-Object -FilterScript {($_.LastWriteTime -gt '2018-04-01')}