List files based on date

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Egan Mike Egan Mike 1 year ago.

  • Author
    Posts
  • #5395

    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
    Profile photo of Egan Mike
    Egan Mike
    Participant

    This information was very helpful. Thank you.

You must be logged in to reply to this topic.