?
Solved

Powershell help - finding files lastwritetime

Posted on 2012-08-20
3
Medium Priority
?
514 Views
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 happens..no errors...nothing


help?
0
Comment
Question by:Tom-J-Lael
3 Comments
 
LVL 13

Accepted Solution

by:
Xaelian earned 750 total points
ID: 38312108
Hi,

You can use this script:

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

Assisted Solution

by:Manpreet SIngh Khatra
Manpreet SIngh Khatra earned 750 total points
ID: 38315556
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
0
 
LVL 3

Author Closing Comment

by:Tom-J-Lael
ID: 38337833
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.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Learn about cloud computing and its benefits for small business owners.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 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