Trying to run an scp command to copy only the content of a directory (not the directory itself) with subprocess i found some problems with wildcards:
scp_result = subprocess.run([
"scp",
"./tosend/archive_*",
"{0}@{1}:{2}/.".format("usr", "192.168.1.2", "/home/usr/scpdir")
], shell=True)
Even using the shell=True option that should allow wildcards i get the error message:
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user@]host1:]file1 ... [[user@]host2:]file2
The CompletedProcess is:
CompletedProcess(args=['scp', './tosend/archive_*', 'usr@192.168.1.2:/home/usr/scpdir/.'], returncode=1)
and seem to contain the right arguments. Trying to copy a single file without the wildcard works perfectly.