Skip to content

Instantly share code, notes, and snippets.

@arcolife
Forked from anonymous/file1.py
Last active August 29, 2015 13:57
Show Gist options
  • Save arcolife/9907089 to your computer and use it in GitHub Desktop.
Save arcolife/9907089 to your computer and use it in GitHub Desktop.
mongo upload script
import os
filenames = os.listdir('./_User_sharded/')
f = open('mongo_upload','wb')
f.write('#!/bin/bash\n')
f.write('cd ./_User_sharded/\n')
for filename in filenames:
cmd = ['mongoimport','--db','takezero_raw','--collection','users','--file',filename]
f.write(' '.join(cmd) + "\n")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment