Share the Knowledge!


Here is a Python script to get the Dropbox status of a file or folder in Windows. It requires the Python win32 extensions, or Active Python.

Look here for a Windows dll with this functionality

A Delphi port (Win32) of this Python script is available at

Author: Steve H

Usage Example

import win32pipe, win32ts, win32api, pywintypes, struct, sys

def dropbox_path_status(pathname):
    return ['dropbox not running',
            'not in dropbox',
            'up to date',
            'sync problem'][dropbox_path_status_code(pathname)+1]

def dropbox_path_status_code(pathname):
    processid = win32api.GetCurrentProcessId()
    threadid = win32api.GetCurrentThreadId()
    request_type = 1
    wtf = 0x3048302
    pipename = r'\\.\PIPE\DropboxPipe_' + \
    request = (struct.pack('LLLL', wtf, processid, threadid, request_type) + \
              pathname.encode('utf-16le') + (chr(0)*540))[0:540]
        response = win32pipe.CallNamedPipe(pipename, request, 16382, 1000)
    except pywintypes.error, err:
        if err[0] == 2:
            return -1
        return int(response[4:-1])

if __name__ == "__main__":
    if len(sys.argv) > 1:
        print 'checking status of', sys.argv[1]
        print dropbox_path_status(sys.argv[1])
        print >> sys.stderr, 'pathname required'

Share the Knowledge!

  • Trinscona

    This script works! after all these years! Big thanks!
    Would love to know the mechanism by which it works. What is the magic number “wtf = 0x3048302”? Under what circumstances (as Dropbox changes over time) would it break? And who really is Steve H?
    Couldn’t find anything on the Internet…