Click here to Skip to main content
15,888,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read file names from a folder which are older than 4 days and write those file names in a log file.

What I have tried:

Get-ChildItem –Path "\\Test\abc" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-4))} | Write-Host “${Item} “
Posted
Updated 9-Apr-19 1:45am
v2

1 solution

Try:
Get-ChildItem  –Path "\\Test\abc" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-4)} | ForEach-Object { $_.FullName } > D:\output.txt
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900