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.
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.
> 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
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
>
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.
>
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find big files | shakey | Vista file management | 5 | 30 Oct 2009 |
| cant find the jpeg files in my temp internet files | Dazed427 | Vista file management | 1 | 03 Jun 2008 |
| Re: find pst files | Shay Levi | PowerShell | 0 | 04 Jan 2008 |
| find pst files | ilann | PowerShell | 4 | 27 Dec 2007 |
| Search for files and folders doesn't find system files | Will Schuitman | Vista General | 1 | 31 Aug 2006 |