Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nctool
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andri Joos
nctool
Commits
f475c8b5
Commit
f475c8b5
authored
1 year ago
by
Andri Joos
Browse files
Options
Downloads
Plain Diff
Merge branch 'shared_link'
parents
5deae75f
94e48ea9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.vscode/launch.json
+2
-2
2 additions, 2 deletions
.vscode/launch.json
README.md
+10
-2
10 additions, 2 deletions
README.md
main.py
+10
-4
10 additions, 4 deletions
main.py
with
22 additions
and
8 deletions
.vscode/launch.json
+
2
−
2
View file @
f475c8b5
...
...
@@ -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"
,
...
...
This diff is collapsed.
Click to expand it.
README.md
+
10
−
2
View file @
f475c8b5
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/
**
/
*
This diff is collapsed.
Click to expand it.
main.py
+
10
−
4
View file @
f475c8b5
...
...
@@ -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
)]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment