Recently I was working at a customer who was looking to migrate some of their content out of Office 365. A decision was made to migrate all content of a single Site Collection out of their tenant. And while there are several third-party solutions to migrate data out of your tenant. We choose to ‘use’ the OneDrive Sync client.
OneDrive Sync client
The OneDrive Sync client makes it easy to sync your files. Event with selective sync you can just right-click to download everything. The only downside was that the site collection contained around 250 GB of content. And that the data consisted of over 160.000 files. So we required some reporting during the sync. The Reports focused on providing details on what was downloaded. And as you can imagine some of the folders where nested quite deep. Fourteen levels of nested folders did occur. Having some reporting can thus help you in identifying problems as well.
Luckily you can use PowerShell to determine the status for each file. So we ended up making a small script. Focusing on validating the OneDrive Sync folder. The script outputs a CSV file containing the file path and OneDrive sync status. Using Excel or PowerBI you can use that status information for additional checks. We used it to make sure the file was synced locally. You can also use the reports to try and open the file if it is not downloaded yet. As hitting the file will trigger the OneDrive sync client to make it available for your user. So while we had to sync 160.000 files the OneDrive sync client worked its magic. We had the proof the files where available, and everybody was happy. All to make sure that we could do the cutover in just a few hours.
So what did we do with PowerShell? We retrieved all items using the
Get-ChildItem and retrieved the required info. We then exported it to a CSV with the
Export-CSV. So you end up with something as follows:
Get-ChildItem "C:\OneDrive\my site\my sycned library" -file -recurse | Select-Object FullName,Attributes | Export-Csv -Path "C:\temp\dummy.csv" -NoTypeInformation
Running that will result in a dummy csv file that contains all files that are on your disk. It also provides a the attribute flag.
"FullName","Attributes" "C:\OneDrive\my site\my sycned library\file1.txt","525344" "C:\OneDrive\my site\my sycned library\file2.txt","5248544" "C:\OneDrive\my site\my sycned library\file3.txt","Archive, ReparsePoint"
You can use those status flags to determine your reports. We reported on anything that was not 525344 as that means always available. The archive, ReparsePoint means it is available but it might be deleted as it is set to free up space if needed. The 5248544 status means not available locally (only online). As the values are bit flags you can translate them to the actual label as well if required. An easy way to