Send file: put
(self, arg, rpath="")
| 470 | |
| 471 | # ------------------------[ put <local file> ]------------------------ |
| 472 | def do_put(self, arg, rpath=""): |
| 473 | "Send file: put <local file>" |
| 474 | if not arg: |
| 475 | arg = eval(input("Local file: ")) |
| 476 | if not rpath: |
| 477 | rpath = os.path.basename(arg) |
| 478 | rpath = self.rpath(rpath) |
| 479 | lpath = os.path.abspath(arg) |
| 480 | # read from local file |
| 481 | data = file().read(lpath) |
| 482 | if data != None: |
| 483 | self.put(rpath, data) |
| 484 | lsize = len(data) |
| 485 | rsize = self.file_exists(rpath) |
| 486 | if rsize == lsize: |
| 487 | print((str(rsize) + " bytes transferred.")) |
| 488 | elif rsize == c.NONEXISTENT: |
| 489 | print("Permission denied.") |
| 490 | else: |
| 491 | self.size_mismatch(lsize, rsize) |
| 492 | |
| 493 | # ------------------------[ append <file> <string> ]------------------ |
| 494 | def do_append(self, arg): |
no test coverage detected