尋找dropbox資料庫目錄


import ctypes, base64, pickle, sqlite3, os

is_windows = True
try:
# try to get Windows path first
SHGetFolderPath = ctypes.windll.shell32.SHGetFolderPathW
except AttributeError:
is_windows = False

if is_windows:
from ctypes.wintypes import HWND, HANDLE, DWORD, LPCWSTR, MAX_PATH
SHGetFolderPath.argtypes = [HWND, ctypes.c_int, HANDLE, DWORD, LPCWSTR]
path_buffer = ctypes.wintypes.create_unicode_buffer(MAX_PATH)
# 26 is CSIDL_APPDATA, the code for retrieving the user's Application Data folder
SHGetFolderPath(0, 26, 0, 0, path_buffer)
dropbox_db_path = path_buffer.value + '\Dropbox\config.sqlite'
else:
dropbox_db_path = os.path.expanduser('~/.dropbox/dropbox.db')

print dropbox_db_path

沒有留言:

張貼留言