23 lines
832 B
Python
23 lines
832 B
Python
import os
|
|
import subprocess
|
|
|
|
def list_files_recursively(directory):
|
|
for root, dirs, files in os.walk(directory):
|
|
for file in files:
|
|
print(os.path.join(root, file))
|
|
upload_file_with_curl(root, file)
|
|
|
|
def upload_file_with_curl(file_path, file_name):
|
|
print(file_path)
|
|
os.chdir(file_path)
|
|
out = subprocess.run(f'curl -u "a.pivkin:qweqwe" -H "Content-Type: multipart/form-data" --data-binary "@./{file_name}" "https://nexus.test.repo.int.nt-com.ru/repository/apt-norsi/"', cwd=file_path, shell=True)
|
|
|
|
# Call the function to upload the file
|
|
|
|
# Specify the directory you want to start listing files from
|
|
directory_path = "/opt/norsi/mirror/nexus.test.repo.int.nt-com.ru/repository/apt-norsi-test/pool/"
|
|
|
|
# Call the function to list files recursively
|
|
list_files_recursively(directory_path)
|
|
|