List files based on date

Welcome Forums General PowerShell Q&A List files based on date

This topic contains 1 reply, has 2 voices, and was last updated by

2 years, 9 months ago.

  • Author
  • #5395

    Points: 0
    Rank: Member

    by RDabate at 2013-01-03 11:42:21

    I'd actually like to add a process, maybe I should open up another question, but here goes. This script copies items to their new location which is great. At the end of the script, I like it to process again, but only in the "Exceptions" folder, and do the following, Move items to the Target Folder based on "Date Modified", then be shorted in the same way as the earlier in the script. Make sense?

    by DonJ at 2013-01-03 11:48:33

    Nope. Doesn't make sense at all.

    Try to break it down for me, and yes, a new topic would probably be appropriate. Are you saying, "I need to get a list of files that have a certain modification date?"

    Get-ChildItem -Path Whatever -Recurse -Include *.txt | Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-90) }

    That will produce a list of files that were written 90 days or more ago. There is no "Date Modified" property – run "Get-ChildItem | Get-Member" to see a list of valid properties.

  • #37250

    Points: 1
    Rank: Member

    This information was very helpful. Thank you.

The topic ‘List files based on date’ is closed to new replies.