Counting Files On A Google Team Drive

After migrating a network share to a Google Team Drive, I realized I didn’t have an easy way of measuring success. Typically, when moving files from one network location to another, I copy the source files to the destination and then use the file properties dialog box to demonstrate that the two folders are in sync.

Here’s what that normally looks like:

The number of files, and file size are the same. There were no errors.
The number of files, and file size are the same. There were no errors.

I used Google Drive File Stream to copy the network share to the Team Drive. Google Drive File Stream creates a local, virtual/mounted drive dubbed “G” which is mostly indistinguishable to the user from an actual local drive or a network share. The root of G has just “My Drive” for the user’s Google Drive files and “Team Drives” for the user’s Team Drives. Unlike Google Drive, files are not necessarily synced to the local computer, but are streamed on demand when users open them, with a healthy level of local caching to speed the process.

So, I thought I could just copy the files from my network share to G:\Team Drives\[Destination] where [Destination] is the name of my new Team Drive. And I was right, but after the process finished, the Team Drive folder’s properties box didn’t contain the information I needed.

After flailing around for a bit, I realized that – virtual drive or not – I could interact with the drive via PowerShell.

First, I got a count of the files in the ‘source’, the network drive I copied files from:

PS O:\Source>Get-ChildItem -Recurse -File | Measure-Object | %{$_.Count}

Then I repeated that step for my destination:

PS G:\Team Drives\Destination>Get-ChildItem -Recurse -File | Measure-Object | %{$_.Count}