Powershell help - finding files lastwritetime

Posted on 2012-08-20
Last Modified: 2012-08-27
I'm trying to create a PS script that finds files (non-recursively) prior to a certain date.

Get-ChildItem e:\cadcam\scandata | Where-Object {$_.LastWriteTime -lt "1/1/2008 00:01 AM"

when I press enter..nothing errors...nothing

Question by:Tom-J-Lael
    LVL 13

    Accepted Solution


    You can use this script:

    $compareDate = Get-Date "1/1/2008 0:01 AM"
    Get-ChildItem E:\cadcam\scandata | Where-Object { $_.LastWriteTime -lt $compareDate }
    LVL 52

    Assisted Solution

    by:Manpreet SIngh Khatra
    Powershell: Find files modified after a certain date

    get-childitem "some folder" -recurse | where-object {$_.mode -notmatch "d"} | where-object {$_.lastwritetime -gt [datetime]::parse("18/07/2010")} | format-table lastwritetime, fullname -autosize | out-file newfiles.log -append

    Powershell - Get Files Grouped by Date and Total Group File Size

    - Rancy
    LVL 3

    Author Closing Comment

    Thanks...I found that the issue was because I did not have the } at the end of my script.

    i did not want to recurse because I only wanted what was in the parent folder.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    data scientists and AI 17 54
    countX 22 50
    inactive users 13 35
    many domain users as service accounts - not documented 2 33
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    This article will show, step by step, how to integrate R code into a R Sweave document
    The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now