Skip to content
Snippets Groups Projects
Commit f475c8b5 authored by Andri Joos's avatar Andri Joos :blush:
Browse files

Merge branch 'shared_link'

parents 5deae75f 94e48ea9
No related branches found
No related tags found
No related merge requests found
......@@ -13,9 +13,9 @@
"justMyCode": true,
"args": [
"--in",
"/media/andri/tmp/mo/Lifjell",
"/media/andri/tmp/test",
"--out",
"/Documents/Adventures/Auslandssemester Norway/04_Lifjell/Moritz/drone",
"/temp",
"--username",
"test",
"--password",
......
following usage is recommended:
```sh
python main.py --username andrijoos --password "$(< /home/andri/tmp/nextcloud_pw.txt)" --in "/media/andri/tmp/mo/Lifjell" --out "/Documents/Adventures Auslandssemester Norway/04_Lifjell/Moritz/drone"
```
\ No newline at end of file
python main.py --username "$(< /home/andri/tmp/nextcloud_user.txt)" --password "$(< /home/andri/tmp/nextcloud_pw.txt)" --in "/media/andri/tmp/mo/Lifjell" --out "/Documents/Adventures Auslandssemester Norway/04_Lifjell/Moritz/drone" -server-address "https://cloud.420joos.dev/"
```
with a shared link:
```sh
python main.py --in "/media/andri/tmp/mo/Lifjell" --out "/" --public-link "https://cloud.420joos.dev/index.php/s/abcdefghij12345"
```
It recursively uploads the content of the `--in` folder into the `--out` folder.
Regex: in_folder/**/*
......@@ -30,8 +30,9 @@ parser = ArgumentParser(prog="NextcloudUpload", description="Upload folders to n
parser.add_argument("--in", action="store", required=True, type=str)
parser.add_argument("--out", action="store", required=True, type=str)
parser.add_argument("--server-address", action="store", default="https://cloud.420joos.dev/", required=False, type=str)
parser.add_argument("--username", action="store", required=True, type=str)
parser.add_argument("--password", action="store", required=True, type=str)
parser.add_argument("--username", action="store", required=False, type=str)
parser.add_argument("--password", action="store", required=False, type=str)
parser.add_argument("--public-link", action="store", required=False, type=str)
args = vars(parser.parse_args())
in_path = args["in"]
......@@ -39,9 +40,14 @@ out_path = args["out"]
server_address = args["server_address"]
username = args["username"]
password = args["password"]
public_link = args["public_link"]
nc = Client(server_address)
nc.login(username, password)
nc: Client = None
if public_link is not None:
nc = Client.from_public_link(public_link)
else:
nc = Client(server_address)
nc.login(username, password)
files_and_directories = glob.glob(os.path.join(in_path, "**/*"), recursive=True)
uploading_files = [f for f in files_and_directories if os.path.isfile(f)]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment