commit 1a5d3695132b83fbaff50ac2c54e01a8601208da Author: a.pivkin Date: Tue Oct 8 15:28:24 2024 +0300 test diff --git a/recursive_the_dirs.py b/recursive_the_dirs.py new file mode 100644 index 0000000..c7c6766 --- /dev/null +++ b/recursive_the_dirs.py @@ -0,0 +1,22 @@ +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) +