Producing a list of files modified in last 48 hours on Windows Server 2012

Does anyone have a quick way of producing a list of files modified in the last 48 hours on Windows Server 2012 ?  I need the list in a text file or excel worksheet ......

Happy for a way to do this through the user interface but would really like some way to script the production of this :)
Michael GreenSenior IT Consultant / IT Project ManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anand PandyaCommented:
You can try for the software like treesize free version or professional version, which may get you files which are recently modified.
JohnBusiness Consultant (Owner)Commented:
I use Tree Size Pro (as above) and it is useful for your task as well as sorting out disk usage (which is the prime reason I purchased it).
Michael GreenSenior IT Consultant / IT Project ManagerAuthor Commented:
Sorry Anand and John but I can't see where Tree Size will give me the report I need to see.  Is there something hidden away in the Pro edition ?
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

JohnBusiness Consultant (Owner)Commented:
Start up Tree Size Pro and then in the right hand Window, click on Age of Files . That does it.

Once you have a graph, you can click on a bar of interest and it brings up an Explorer window of details.

I can get of list of aged files in seconds.
Michael GreenSenior IT Consultant / IT Project ManagerAuthor Commented:
OK - I found a way to do this with the Pro version using the File Search filtering.  

However I was hoping for something I could automate e.g. scripting....

Does anyone have anything ?  Any suggestions other than hand coding a script ?
JohnBusiness Consultant (Owner)Commented:
DIR has the ability to list by date and so you could use Powershell to get files between this date and that date.

You can send a Tree Size scan to an XML, XLS, or CSV with the Export function under File.
Michael GreenSenior IT Consultant / IT Project ManagerAuthor Commented:
John I can't see how DIR can filter by date
JohnBusiness Consultant (Owner)Commented:
DIR won't filter by date, but Powershell is a super set of ordinary commands. I am not a Powershell expert.

I would get the file I need from Tree Size.
JohnBusiness Consultant (Owner)Commented:
Let's stand back.

Open Tree Size on your server, scan the C: drive or whatever, wait of the scan to complete (may take a file minutes), click on the Age of File tab, set your criteria, Export to XSL and you are done.
Anand PandyaCommented:
There will be also trial version for pro available, you can use it to scan the drives for once, if it fulfils your need then you can go ahead with the purchase as it is useful tool.
There are various formats in which you can export the data such as in charts, graphs or in excel sheet i.e. .CSV and can also copy and paste the data as normal.
The simple way is to open a system explorer browser window and user the search field at the top right hand corner and enter "datemodified:yesterday" or select period from calendar dropdown. You will get a list of all the modified files without the need to use third party software.
Here's a Powershell script that should do the job. You can optionally pass it an include filter ("*.log", "*.txt").
MinAge and MaxAge expect the respective file ages in hours, and if ExportPath is set, it will write a csv file to the path specified here; otherwise the output will be written to the PS pipeline for further processing.
	[string]$Path = "C:\",
	[int]$MinAge = 0,
	[int]$MaxAge = 48,
$MinAccess = (Get-Date).AddHours(-$MinAge)
$MaxAccess = (Get-Date).AddHours(-$MaxAge)
$gciArgs = @{}
If ($Include) {
	$gciArgs["Include"] = $Include
$Expression = {
	Get-ChildItem -Path $Path -Recurse -File -Force @gciArgs -ErrorAction SilentlyContinue |
		Where-Object {($MaxAccess -le $_.LastWriteTime) -And ($_.LastWriteTime -lt $MinAccess)} | 
		Select-Object -Property FullName, CreationTime, LastWriteTime
If ([string]::IsNullOrEmpty($ExportPath)) {
	Invoke-Command -ScriptBlock $Expression
} Else {
	Invoke-Command -ScriptBlock $Expression |
		ForEach-Object {
			Write-Host -ForegroundColor White "." -NoNewline
		} |
		Export-Csv -Path $ExportPath -NoTypeInformation
	Write-Host -ForegroundColor White "`r`nResults written to '$($ExportPath)'."

Open in new window

David Johnson, CD, MVPOwnerCommented:
Powershell find files modified in the last 2 days
$today = get-date
$2daysago = $today.adddays(-2)
$startdir ='G:\Documents\Audible\Logs\'
$files = dir -Path $startdir -Recurse | ? {$_.lastwritetime -gt $2daysago } 
$output = @()
foreach ($file in $files) {
$object = new-object -TypeName PSObject
$object | add-member -MemberType NoteProperty -Name LastWriteDate -Value $file.LastWriteTime
$object | add-member  -MemberType NoteProperty -Name Filename -Value $file.FullName
$output += $object 
$output | Export-csv -nti c:\temp\files.csv

notepad C:\temp\files.csv

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2008

From novice to tech pro — start learning today.