Life’s nuts, but I managed to create another PowerShell Provider I desperately need.  This one mounts your Dropbox account as a PowerShell drive.  Its functionality is limited, but it’s still wicked awesome.

The module is available in the gallery, and the source code is available on github.  The provider is built on top of P2F so the code is minimal.

The available feature set is really driven by my immediate needs.  In short, I found myself needing to filter large collections of files from across the corporate Dropbox hive and push their contents to Azure blob storage.  So at present, this first release supports basic navigation, as well as the get/set-content cmdlets.

Usage is pretty straightforward if you’ve used PowerShell modules and providers.  This example below mounts a Dropbox account and lists the contents in the root path:

import-module dropbox;
new-psdrive -name dp -psprovider dropbox -root '';
# powershell will open a window here to allow you 
# to authenticate with dropbox
cd dp:

Getting the content of files from Dropbox is a simple matter of using the get-content cmdlet.  The provider transfers all files as raw byte arrays, so you need to take special care when saving the files locally:

$bytes = get-content dp:/data/file.txt;
[io.file]::writeAllBytes( "c:\data\file.txt", $bytes);
get-item c:\data\file.txt;

Eventually I’d like this module to support full item operations on the Dropbox hive.  But, you know me, I’ll get to it when I actually need it.