Exemplo n.º 1
0
 def rename(self, source: str, dest: str) -> FromTo:
     info = self._baidupcs.rename(source, dest)
     r = info["extra"].get("list")
     if not r:
         raise BaiduPCSError("File operator [rename] fails")
     v = r[0]
     return FromTo(from_=v["from"], to_=v["to"])
Exemplo n.º 2
0
    def copy(self, *remotepaths: str):
        """Copy `remotepaths[:-1]` to `remotepaths[-1]`"""

        info = self._baidupcs.copy(*remotepaths)
        r = info["extra"].get("list")
        if not r:
            raise BaiduPCSError("File operator [copy] fails")
        return [FromTo(from_=v["from"], to_=v["to"]) for v in r]
Exemplo n.º 3
0
    def move(self, *remotepaths: str) -> List[FromTo]:
        """Move `remotepaths[:-1]` to `remotepaths[-1]`"""

        info = self._baidupcs.move(*remotepaths)
        r = info["extra"].get("list")
        if not r:
            raise BaiduPCSError("File operator [move] fails")
        return [FromTo(from_=v["from"], to_=v["to"]) for v in r]