| skipped 200 lines |
201 | 201 | | #about |
202 | 202 | | elif command[0:7].lower()=="--about" or command[0:5].lower()=="about": |
203 | 203 | | print(about()) |
| 204 | + | #cp |
| 205 | + | elif command[0:4].lower()=="--mv" or command[0:2].lower()=="mv": |
| 206 | + | ppth=command.split(" ") |
| 207 | + | try: |
| 208 | + | command=simulate_mv(ppth[1],ppth[2]) |
| 209 | + | print(hiphp.do(self,self.key,self.url,self.headers,True,command)) |
| 210 | + | except: |
| 211 | + | help(__version__,"--mv") |
204 | 212 | | #download |
205 | 213 | | elif command[0:6].lower()=="--down" or command[0:4].lower()=="down" or command[0:8].lower()=="download": |
206 | 214 | | down=command.split(" ") |
| skipped 284 lines |
491 | 499 | | |
492 | 500 | | #upload: |
493 | 501 | | def upload(self,path_to_upluad,to=""): |
| 502 | + | self.DS=hiphp.do(self,self.key,self.url,self.headers,True,DIRECTORY_SEPARATOR()) |
494 | 503 | | try: |
495 | 504 | | with open(path_to_upluad,"rb") as base64_file: |
496 | 505 | | encoded_string=tobase64(base64_file.read().decode("utf-8")) |
| skipped 19 lines |
516 | 525 | | |
517 | 526 | | #download: |
518 | 527 | | def download(self,path_x,outpath=""): |
| 528 | + | def get_download_folder(): |
| 529 | + | if os.name == 'nt': # Windows |
| 530 | + | download_folder = os.path.expanduser('~/Downloads') |
| 531 | + | elif os.name == 'posix': # Linux, macOS, and other UNIX-based systems |
| 532 | + | download_folder = os.path.expanduser('~/Downloads') |
| 533 | + | else: |
| 534 | + | # Unsupported operating system |
| 535 | + | download_folder = None |
| 536 | + | |
| 537 | + | return download_folder |
| 538 | + | download_folder = get_download_folder() |
| 539 | + | if download_folder: |
| 540 | + | outpath=download_folder |
| 541 | + | else: |
| 542 | + | outpath=os.path.abspath(os.getcwd()) |
| 543 | + | |
| 544 | + | |
519 | 545 | | new_command=file_to_b64(path_x) |
520 | 546 | | path_x=os.path.basename(path_x) |
521 | | - | if outpath=="": |
522 | | - | outpath=os.path.abspath(os.getcwd()) |
| 547 | + | #if outpath=="": |
| 548 | + | # outpath=os.path.abspath(os.getcwd()) |
523 | 549 | | |
524 | 550 | | if outpath[-1]!=self.sep: |
525 | 551 | | outpath+=self.sep |
| skipped 29 lines |