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
cant find the jpeg files in my temp internet files
seem to have lost viewing of the temp jpeg files...only files that are showing now are tmp and wmp files that do not open to view..I have changed...
Vista file management
Re: find pst files
Dependeing on the PST file size the user might be *never* logged off and might brutally turn off the computer thinking its hanged. This kind of...
PowerShell
find pst files
Hi, I need to find pst files on all desktops and move those files on a fileserver. how could I do that via a script? --Ilann
PowerShell
Re: find pst files
I think the copy will fail. the best way to know for sure is to create a PST on your local computer, attach it to your outlook while it's open,...
PowerShell
Cannot find files
Everytime i download a file it seems to have downloaded properly but when i go to the folder where the file was supposed to be, it is empty. I have...
Vista file management
Cant find files
I am having a huge problem with Vista\Office Professional 2007. Main problem is I can't open Outlook and get the following message Failed to...
Vista installation & setup
Search for files and folders doesn't find system files
I was lookiong for a system to fix a problem I have. In folder uptions I changed the setting to show hidden files and folders and unchecked the hide...
Vista General