mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-28 12:56:28 -04:00
Removed unneeded import statement and file exists checks
Former-commit-id: b20e08c31225cc085ef4dfbc801954742a59d3ae Former-commit-id: 28edd16022adea08295a917affb85e0a3d28fb1f
This commit is contained in:
+1
-8
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
from configparser import ConfigParser, NoSectionError
|
||||
from os import chmod, environ, listdir, remove, walk
|
||||
from os.path import exists, expanduser, isdir, isfile, realpath
|
||||
from os.path import expanduser, isdir, isfile, realpath
|
||||
from pathlib import Path
|
||||
from random import randint
|
||||
from shutil import move, rmtree
|
||||
@@ -549,10 +549,6 @@ def rename():
|
||||
|
||||
# if renaming a file
|
||||
if _file:
|
||||
# check if the new file already exists
|
||||
if isfile(f"{directory}{_new_name}.gpg"):
|
||||
print(f"\n\u001b[38;5;9merror: (/{_new_name}) already exists\u001b[0m\n")
|
||||
s_exit(3)
|
||||
if not ssh_error:
|
||||
copy(f"{directory}{entry_name}.gpg", f"{directory}{_new_name}.gpg")
|
||||
else:
|
||||
@@ -560,9 +556,6 @@ def rename():
|
||||
else:
|
||||
|
||||
# if renaming a folder
|
||||
if isdir(f"{directory}{_new_name}"):
|
||||
print(f"\n\u001b[38;5;9merror: (/{_new_name}/) already exists\u001b[0m\n")
|
||||
s_exit(3)
|
||||
if not ssh_error:
|
||||
Path(f"{directory}{_new_name}").mkdir(mode=0o700, parents=True, exist_ok=True)
|
||||
run(('ssh', '-i', f"{home}/.ssh/sshyp", '-p', port, f"{username_ssh}@{ip}",
|
||||
|
||||
Reference in New Issue
Block a user