def moveto(self,
               new_abspath=None,
               new_dirpath=None,
               new_dirname=None,
               new_basename=None,
               new_fname=None,
               new_ext=None,
               overwrite=False,
               makedirs=False):
        """
        An advanced :meth:`pathlib_mate.pathlib2.Path.rename` method provide ability to rename by
        each components of a path. A new ``Path`` instance will returns.

        **中文文档**

        高级重命名函数, 允许用于根据路径的各个组成部分进行重命名。但和os.rename
        方法一样, 需要保证母文件夹存在。
        """
        self.assert_exists()

        p = self.change(
            new_abspath=new_abspath,
            new_dirpath=new_dirpath,
            new_dirname=new_dirname,
            new_basename=new_basename,
            new_fname=new_fname,
            new_ext=new_ext,
        )

        if p.is_not_exist_or_allow_overwrite(overwrite=overwrite):
            # 如果两个路径不同, 才进行move
            if self.abspath != p.abspath:
                if makedirs:
                    parent = p.parent
                    if not parent.exists():
                        os.makedirs(parent.abspath)
                self.rename(p)
        return p
def moveto(self,
               new_abspath=None,
               new_dirpath=None,
               new_dirname=None,
               new_basename=None,
               new_fname=None,
               new_ext=None,
               overwrite=False,
               makedirs=False):
        """
        An advanced :meth:`pathlib_mate.pathlib2.Path.rename` method provide ability to rename by
        each components of a path. A new ``Path`` instance will returns.

        **中文文档**

        高级重命名函数, 允许用于根据路径的各个组成部分进行重命名。但和os.rename
        方法一样, 需要保证母文件夹存在。
        """
        self.assert_exists()

        p = self.change(
            new_abspath=new_abspath,
            new_dirpath=new_dirpath,
            new_dirname=new_dirname,
            new_basename=new_basename,
            new_fname=new_fname,
            new_ext=new_ext,
        )

        if p.is_not_exist_or_allow_overwrite(overwrite=overwrite):
            # 如果两个路径不同, 才进行move
            if self.abspath != p.abspath:
                if makedirs:
                    parent = p.parent
                    if not parent.exists():
                        os.makedirs(parent.abspath)
                self.rename(p)
        return p
def moveto ( self , new_abspath = None , new_dirpath = None , new_dirname = None , new_basename = None , new_fname = None , new_ext = None , overwrite = False , makedirs = False ) : self . assert_exists ( ) p = self . change ( new_abspath = new_abspath , new_dirpath = new_dirpath , new_dirname = new_dirname , new_basename = new_basename , new_fname = new_fname , new_ext = new_ext , ) if p . is_not_exist_or_allow_overwrite ( overwrite = overwrite ) : # 如果两个路径不同, 才进行move if self . abspath != p . abspath : if makedirs : parent = p . parent if not parent . exists ( ) : os . makedirs ( parent . abspath ) self . rename ( p ) return p
An advanced :meth:`pathlib_mate.pathlib2.Path.rename` method provide ability to rename by
        each components of a path. A new ``Path`` instance will returns.

        **中文文档**

        高级重命名函数, 允许用于根据路径的各个组成部分进行重命名。但和os.rename
        方法一样, 需要保证母文件夹存在。
An advanced : meth : pathlib_mate . pathlib2 . Path . rename method provide ability to rename by each components of a path . A new Path instance will returns .