-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example script sophomorix-collect (python) added
- Loading branch information
Showing
3 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/python3 | ||
|
||
# austeilen: /usr/sbin/sophomorix-transfer -jj --scopy --from-user rrrr --to-user t20,t13,t02,t10,t16,t11,t17,t08,t26,t03,t14,t19,t06,t09,t22,t15,t24,t25,t21,t18,t01,t23,t04,t05,t12,t07 --from-path transfer/ausdruck-fertig.pdf --to-path transfer/rrrr_test/ | ||
|
||
# einsammeln: | ||
# /usr/sbin/sophomorix-transfer -jj --move --keep-source-directory --from-user t20,t13,t02,t10,t16,t11,t17,t08,t26,t03,t14,t19,t06,t09,t22,t15,t24,t25,t21,t18,t01,t23,t04,t05,t12,t07, --to-user rrrr --from-path transfer/rrrr_test --to-path transfer/collected/20220401_15-30-04-test/ --to-path-addon fullinfo --no-target-directory::18230:: | ||
|
||
import sophomorix.smbclient | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(add_help = True, | ||
description = "SMB client for sophomorix to collect data from multiple users to one user") | ||
parser.add_argument('--scopy', | ||
action="store_true", # 'True' is the default | ||
default=True, | ||
help='copy the files with sever-site copy method') | ||
parser.add_argument('to_user', | ||
type=str, | ||
help='single user that collects data') | ||
parser.add_argument('--from-path', | ||
type=str, | ||
default='transfer', | ||
help='subdir in (multiple) users home that contains the source data') | ||
parser.add_argument('from_users', | ||
nargs='+', # at least one argument, maybe more | ||
type=str, | ||
help='(multiple) users that have the source data that is collected') | ||
parser.add_argument('--to-path', | ||
type=str, | ||
default='transfer', | ||
help='subdir in single target users home') | ||
arguments = parser.parse_args() | ||
config = vars(arguments) | ||
|
||
# the arguments are collected in the dictionary 'config' | ||
print(config) | ||
|
||
print("############################################################") | ||
|
||
# select one value from the arguments object | ||
print(f"1) The target user is: {arguments.to_user}") | ||
print(f"1) The source users are: {arguments.from_users}") | ||
|
||
# select one value from the config dictionary | ||
print(f"2) The target user is: {config['to_user']}") | ||
print(f"2) The source users are: {config['from_users']}") | ||
|
||
|
||
sophomorix.smbclient.collect(config) | ||
|
||
|
||
#help(sophomorix.smbclient.collect) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters