Get count of objects in a directory with PowerShell

A quick post!

Today I started migrating content from an on-premises source to SharePoint Online using ShareGate’s Migration tool (AWESOME TOOL by the way!). I’m about 2 hours in to the migration and I was curious how much content I had to go. I need to get a count of all the objects in the directory. PowerShell to the rescue:

$path = "[paste directory path here]"
$files = gci $path -recurse | Measure-Object
$files.Count

You’ll get a count of all the objects in the directory. This number will help me gauge how long the migration will take. Happy migration!