Esempio 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"])
Esempio 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]
Esempio 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]