Windows Vista Forums

Find files

  1. #1


    acatejr@gmail.com Guest

    Find files

    Hi,

    I am very new to using PowerShell. I would like it to search for files
    on a drive that are of a certain size and created between two specific
    dates. If anyone can help I'd be grateful. Thanks in advance.


      My System SpecsSystem Spec

  2. #2


    Marco Shaw Guest

    Re: Find files

    > I am very new to using PowerShell. I would like it to search for files
    > on a drive that are of a certain size and created between two specific
    > dates. If anyone can help I'd be grateful. Thanks in advance.


    For example:
    28> get-childitem|where {$_.lastwritetime -gt
    [datetime]::now.date.adddays(-10) -and $_.lastwritetime -lt
    [datetime]::now.date.adddays(-2) -and $_.length -gt 100}

    'get-childitem -recurse' would go through all the sub-dirs also.

    So the above gets files created in the last 10 days, up to 2 days ago.
    Also, it will only get files larger than 100.

    Marco



      My System SpecsSystem Spec

  3. #3


    $hay Guest

    Re: Find files

    for the creation date just replace $_.lastwritetime with $_.CreationTime

    --
    $hay
    http://scriptolog.blogspot.com



    "Marco Shaw" <marcoDOTshaw_@_gmailDOTcom> wrote in message
    news:u01VjryOHHA.2232@TK2MSFTNGP02.phx.gbl...
    >> I am very new to using PowerShell. I would like it to search for files
    >> on a drive that are of a certain size and created between two specific
    >> dates. If anyone can help I'd be grateful. Thanks in advance.

    >
    > For example:
    > 28> get-childitem|where {$_.lastwritetime -gt
    > [datetime]::now.date.adddays(-10) -and $_.lastwritetime -lt
    > [datetime]::now.date.adddays(-2) -and $_.length -gt 100}
    >
    > 'get-childitem -recurse' would go through all the sub-dirs also.
    >
    > So the above gets files created in the last 10 days, up to 2 days ago.
    > Also, it will only get files larger than 100.
    >
    > Marco
    >




      My System SpecsSystem Spec

  4. #4


    $hay Guest

    Re: Find files

    You can replace the requested file size (e.g 100) with:

    1kb
    1mb
    1gb

    another example

    get-childitem $env:userprofile"\desktop" -recurse| where {$_.length -gt 1mb}
    | select name,length | sort length -desc | ft -autosize | more

    Will drilldown the current user desktop for files greater than 1mb
    and display the results (file name and file size) sorted by the file size,
    bigger first.
    a -filter can be added to reduce the number of returned objects.

    Dont forget to double check your self when preforming distructive actions on
    the files
    use - whatif to test the operation and even -confirm to be on the safe side

    --
    $hay
    http://scriptolog.blogspot.com



    <acatejr@gmail.com> wrote in message
    news:1169139729.858803.215170@38g2000cwa.googlegroups.com...
    > Hi,
    >
    > I am very new to using PowerShell. I would like it to search for files
    > on a drive that are of a certain size and created between two specific
    > dates. If anyone can help I'd be grateful. Thanks in advance.
    >




      My System SpecsSystem Spec


Find files
Similar Threads
Thread Forum
find big files Vista file management
cant find the jpeg files in my temp internet files Vista file management
Re: find pst files PowerShell
find pst files PowerShell
Search for files and folders doesn't find system files Vista General