Changing MongoDB data store directory

The short answer is that the –dbpath parameter in MongoDB will allow you to control what directory MongoDB reads and writes it’s data from. mongod –dbpath /usr/local/mongodb-data Would start mongodb and put the files in /usr/local/mongodb-data. Depending on your distribution and MongoDB installation, you can also configure the mongod.conf file to do this automatically: # … Read more

Extract a part of the filepath (a directory) in Python

import os ## first file in current dir (with full path) file = os.path.join(os.getcwd(), os.listdir(os.getcwd())[0]) file os.path.dirname(file) ## directory of file os.path.dirname(os.path.dirname(file)) ## directory of directory of file … And you can continue doing this as many times as necessary… Edit: from os.path, you can use either os.path.split or os.path.basename: dir = os.path.dirname(os.path.dirname(file)) ## dir … Read more

How to get full path of selected file on change of using javascript, jquery-ajax?

For security reasons browsers do not allow this, i.e. JavaScript in browser has no access to the File System, however using HTML5 File API, only Firefox provides a mozFullPath property, but if you try to get the value it returns an empty string: $(‘input[type=file]’).change(function () { console.log(this.files[0].mozFullPath); }); https://jsfiddle.net/SCK5A/ So don’t waste your time. edit: … Read more