I have the code that you can see below. I'm trying to go first to the directory and then,with the pipe "|" make a backup of the MongoDB´s database.The problem is that when I launch the script the console returns me
mongodump is not an internal or external command.
On the other hand,if I launch the same line
cd C:\\...\\MongoDB\\Server\\3.6\\bin | mongodump -h ip -d database name -o C:\\Users\\...\\Desktop\\BackUpMongo
in my system cmd it works without problems. Any idea?
import sys
import os
if __name__ == '__main__':
try:
os.system('cd C:\\...\\MongoDB\\Server\\3.6\\bin | mongodump -h ip -d database name -o C:\\Users\\...\\Desktop\\BackUpMongo')
print("Copia de seguridad finalizada")
except:
print("Error during data base backup")
sys.exit(0)