Not only are we worried about the shear amount of data but what is relevant and was is duplicate information? Using PowerShell we can easily weed out the files and folders within a path that are older than a certain date-time.
$files = get-childitem \\share –recurse | ?{$_.CreationTime -gt “Date”}
Then we can do some operation on that subset of files.
But a key metric that can help establish growth and usage is new file creation. How many new files are created daily? How many are updated? What are the busy days of the week for new/modified files? I am currently working on a project where they have a 1TB file share and they estimate that maybe 20% of data is pertinent information.They want to move it to SharePoint Online (O365) so storage space comes at a price. So to help get an idea of how data is being added to a certain location daily I whipped up a PowerShell script to tell us just that. It gives you a good trend analysis over any defined start/end time.
As you can see, this data shows us how many files are being added to this particular share(File path) daily from 8/1/2012 – 9/1/2012. It also tells us what our busiest days for new data are along with the estimated size added per day. This can be valuable information when we think about scaling a system to accommodate an already growing file system.
Right now the script is set to look for NEW files but I am adding in the ability check for modified files daily as well. Modified metrics are not as valuable because we are normally making minor edits and not adding several MB of content. However, It does offer some information on daily usage(hits) that would be redirected to SharePoint in a scenario where file shares are being replaced by SharePoint.
#Script
New-FileReport.ps1
$files = Get-ChildItem "FilePath" -Recurse
[datetime]$StartDate = "8/1/2012"
[datetime]$EndDate = "9/1/2012"
[datetime]$CurDate = $StartDate
$output = ""
$output += "Date,TotalFiles,Size,Day`n"
while ($CurDate-le $EndDate)
{
$tfiles = $files | where {$_.CreationTime -ge (Get-date -Date $CurDate -UFormat %m/%d/%Y) -and $_.CreationTime -lt (Get-date -Date $CurDate.AddDays(1) -UFormat %m/%d/%Y) }
[double]$TotalSize = "0"
$TotalFiles = $tfiles.count
if ($TotalFiles -gt 1)
{
foreach ($f in $tfiles)
{
$TotalSize += $f.Length /1MB
}
}
else
{
$TotalSize = $f.Length /1MB
}
$day = $CurDate.DayOfWeek
$output += "$CurDate,$TotalFiles,$TotalSize,$Day`n"
#$output
$CurDate = $CurDate.AddDays(1)
}
$output | Out-File $path\FileInfo.csv -Force
No comments:
Post a Comment