check if file is directory before get/put