Skip to content

Instantly share code, notes, and snippets.

Created April 1, 2014 03:20
Show Gist options
  • Save anonymous/9907088 to your computer and use it in GitHub Desktop.
Save anonymous/9907088 to your computer and use it in GitHub Desktop.
Pasted from IPython
import os
filenames = os.listdir('./_User_sharded/')
filenames
cmd = ['mongoimport','--db','takezero_raw','--collection','users','--file',filename]
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))
f.close()
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