A method to update the parent directory number for this Path Table
        Record from the directory record.

        Parameters:
         parent_dir_num - The new parent directory number to assign to this PTR.
        Returns:
         Nothing.
767889
def update_parent_directory_number(self, parent_dir_num):
        # type: (int) -> None
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record not yet initialized')
        self.parent_directory_num = parent_dir_num
1136910
def _dirdiffandupdate(self, dir1, dir2):
        
        self._dowork(dir1, dir2, None, self._update)
280690
def num_images_in_dir(path):
    
    num_imgs = 0
    for root, dirs, files in os.walk(path):
        for fname in files:
            if fpath_has_imgext(fname):
                num_imgs += 1
    return num_imgs
1219967
def get_parent_dept_path(self):
        """"""
        self.logger.info("%s\t%s" % (self.request_method, self.request_url))
        return self.json_response.get("parentIds", None)
900314
public function setDirectory()
    {
        $pos = strrpos($this->dirPath, DIRECTORY_SEPARATOR);
        $this->directory = substr($this->dirPath, $pos + 1);
    }
1046143
def mkdir(path, parents=False):
    
    func = os.makedirs if parents else os.mkdir
    try:
        return func(path)
    except:
        if not parents:
            raise
918014
def has_parent_object(self, dir_object):
        """"""
        obj = self
        while obj:
            if obj == dir_object:
                return True
            obj = obj.parent_dir
        return False
1054784
def movefile(source_path, dest_path, make_parents=False, backup_suffix=None):
  
  if make_parents:
    make_parent_dirs(dest_path)
  move_to_backup(dest_path, backup_suffix=backup_suffix)
  shutil.move(source_path, dest_path)
681385
def change_directory(self, path, *args, **kwargs):
		
		client = self.dav_client()
		previous_path = self.session_path()
		try:
			if client.is_dir(self.session_path(path)) is False:
				raise ValueError('Unable to change current working directory to non-directory entry')
		except Exception:
			self.session_path(previous_path)
			raise
139990
def _setup_dir(self, base_dir):
        
        stats_dir = self._sdir(base_dir)

        if not os.path.isdir(stats_dir):
            try:
                os.mkdir(stats_dir)
            except OSError:
                raise errors.DirectorySetupFail()
57436
def mkdir(self, path, title="", recurse=False):
        
        head, tail = os.path.split(os.path.normpath(path))
        if tail == "":
            raise ValueError("invalid directory name: {0}".format(path))
        with preserve_current_directory():
            dest = self
            if recurse:
                parent_dirs = head.split(os.path.sep)
                for parent_dir in parent_dirs:
                    try:
                        newdest = dest.GetDirectory(parent_dir)
                        dest = newdest
                    except DoesNotExist:
                        dest = dest.mkdir(parent_dir)
            elif head != "":
                dest = dest.GetDirectory(head)
            if tail in dest:
                raise ValueError("{0} already exists".format(path))
            newdir = asrootpy(super(_DirectoryBase, dest).mkdir(tail, title))
        return newdir
313668
def set_parent(self, parent):
        
        self.parent = parent

        if self.config_type == 'edit':
            self.rel_path_fwd = 'edit %s\n' % self.get_name()
            self.rel_path_bwd = 'next\n'
        elif self.config_type == 'config':
            self.rel_path_fwd = 'config %s\n' % self.get_name()
            self.rel_path_bwd = 'end\n'

        self.full_path_fwd = '%s%s' % (self.get_parent().full_path_fwd, self.rel_path_fwd)
        self.full_path_bwd = '%s%s' % (self.rel_path_bwd, self.get_parent().full_path_bwd)
1280840
def set_dir(self, dir_):
        """"""

        self.__lock_set_dir(dir_)
        self.__lock_auto_load()
        self.__lock_update_table()
        self.__update_info()
        self.__update_window_title()
775402
def move_files_to_folders(directory):
    
    # Generate lists of files and folders in root directory
    files, folders, files_to_move = [], [], []
    for path in os.listdir(directory):
        if os.path.isdir(path):
            folders.append(path)
        elif os.path.isfile(path):
            files.append(path)

    # Loop through folders in root directory
    for path in folders:
        # Generate list of files with same prefix as current folder
        child_files = [f for f in files if f.startswith(path)]
        files_to_move.append((path, child_files))

    # Move child files into parent folder
    for each in files_to_move:
        folder, files = each
        for f in files:
            shutil.move(f, folder)
1090864
function(parent, fileName, callback) {
			fs.stat(parent, function(err, stat) {
				if (err) {
					return callback(err);
				}

				if (stat.isFile()) {
					parent = path.dirname(parent);
				}

				var filepath = path.resolve(parent, fileName);
				callback(null, filepath);
			});
		}
676053
def get_parent_dir(name):
    """"""
    parent_dir = os.path.dirname(os.path.dirname(name))
    if parent_dir:
        return parent_dir
    return os.path.abspath('.')
1189710
def parent_directory(self):
        """"""
        self.chdir(os.path.join(getcwd_or_home(), os.path.pardir))