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!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s