Advertisement
Guest User

Untitled

a guest
Mar 7th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # 1. create file install.py inside of this directory with .sql files
  4. # 2. place it inside of file (adjust dbname dbuser and dbpass)
  5. # 3. run python install.py
  6.  
  7. from os import listdir
  8. from os.path import isfile, join
  9. from os import system
  10.  
  11. mypath = "."
  12. dbname = "comp1482bb"
  13. dbuser = "wpml"
  14. dbpass = "wpml"
  15.  
  16.  
  17. onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
  18.  
  19. for f in onlyfiles:
  20. if f[-4:] == ".sql":
  21. system("mysql -u "+dbuser+" -p"+dbpass+" "+dbname+" < "+f)
  22. print "File "+f+" imported"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement