Check whether a folder exists, if not the folder is created.

    :param folder_path:
        Path to the folder
    :type folder_path:
        String

    :returns:
        (String) the path to the folder
183567
def check_create_folder(folder_path):
    
    if not os.path.exists(folder_path):
        os.makedirs(folder_path)

    return folder_path
678324
def validate_files_exist(self, folder, resources):
        
        for item in resources:
            file_name = item.get('path')
            full_path = os.path.join(folder, file_name)
            if not os.path.isfile(full_path):
                raise ValueError('%s does not exist' % full_path)
581386
def _cs_path_exists(fspath):
        
        if not os.path.exists(fspath):
            return False
        # make absolute so we always have a directory
        abspath = os.path.abspath(fspath)
        directory, filename = os.path.split(abspath)
        return filename in os.listdir(directory)
680587
def _assert_path_is_dir(self, dir_path):
        
        if not os.path.isdir(dir_path):
            raise django.core.management.base.CommandError(
                'Invalid dir path. path="{}"'.format(dir_path)
            )
231337
def create_directory(self, path=None):
        
        if path is None:
            path = self.get_path()
        if not os.path.exists(path):
            os.makedirs(path)
630371
def make_folder(path):
    
    if not os.path.exists(path):
        try:
            os.makedirs(path)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise ValueError('Specified folder is not writable: %s'
                                 '\nPlease check permissions or set a new valid folder.' % path)
22312
def file_is_present(self, file_path):
        
        p = self.p(file_path)
        if not os.path.exists(p):
            return False
        if not os.path.isfile(p):
            raise IOError("%s is not a file" % file_path)
        return True
1000390
def _ensure_module_folder_exists():
  
  if not os.path.isdir(MODULES_FOLDER_PATH):
    try:
      os.mkdir(MODULES_FOLDER_PATH)
    except OSError, e:
      if "file already exists" in str(e):
        raise RuntimeError("Could not create modules folder: file exists with the same name")
925848
def path_exists(self, path, follow_symlinks=True):
        ""
        return (
            self.file_exists(path, follow_symlinks)
            or self.symlink_exists(path, follow_symlinks)
            or self.directory_exists(path, follow_symlinks)
        )
1371993
def _check_module(folder):
        
        if not folder.exists():
            folder.mkdir(parents=True, exist_ok=True, mode=0o755)
            (folder / '__init__.py').touch()
865444
def _inform_if_path_does_not_exist(path):
    
    expanded_path = get_expanded_path(path)
    if not os.path.exists(expanded_path):
        print('Could not find custom path at: {}'.format(expanded_path))
634462
def check_subdirectory(subpath)
      subdirectory = File.join(path, subpath)
      subdirectory if File.directory?(subdirectory)
    end
258197
def is_dir_exists(dirpath):
        # type: (AnyStr) -> bool
        """"""
        if dirpath is None or not os.path.exists(dirpath) or not os.path.isdir(dirpath):
            return False
        else:
            return True
1288831
def directory_is_present(self, directory_path):
        
        p = self.p(directory_path)
        if not os.path.exists(p):
            return False
        if not os.path.isdir(p):
            raise IOError("%s is not a directory" % directory_path)
        return True
200634
def create_dir(path):
    
    # https://stackoverflow.com/a/5032238
    try:
        os.makedirs(path, exist_ok=True)
    except Exception as err:
        print(err)
        return False

    if os.path.exists(path):
        return True
    else:
        return False
1004902
def check_exists(path, type='file'):
    

    if type == 'file':
        if not os.path.isfile(path):
            raise RuntimeError('The file `%s` does not exist.' % path)
    else:
        if not os.path.isdir(path):
            raise RuntimeError('The folder `%s` does not exist.' % path)

    return True
1208640
public static function checkFolderPath($path){
      $path = substr($path,strpos($path,'/')+1);
      $path = explode('/',trim($path,'/'));
        foreach ( $path as $dir ){
          if ( !empty($dir) && !CKFinder_Connector_Utils_FileSystem::checkFolderName($dir) ){
            return false;
          }
        }

        return true;
    }