Python Forum
uploading files from a ubuntu local directory to Minio storage container
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
uploading files from a ubuntu local directory to Minio storage container
#1
I want to upload files (text and binary) from my local machine running ubuntu 20.04 to a Minio storage container also in the same machine.
below are the variables for the files
local_path = /usr/carte/proftpd/aws01y
minio_path = original/tza/a
S3_BUCKET_INCOMING = 'Data-incoming'
my problem is where should i define the local_path and mino_path inside my code so that python will know where to file the files and where to put them

here is my code

import glob
import sys

from minio import Minio

local_path = sys.argv[1]
minio_path = sys.argv[2]

filepaths = glob.glob(local_path)
if len(filepaths) == 0:
    print(f'No files found for pattern={local_path}')

S3_ENDPOINT = 'http://localhost:9000'
S3_USER = 'Tzabox'
# replace with the value of STORAGE_PASSWORD in your .env file
S3_PASSWORD = '******'
S3_BUCKET_INCOMING = 'Data-incoming'
if S3_ENDPOINT != '':
    endpoint = ''
    if S3_ENDPOINT.startswith('https://'):
        is_secure = True
        endpoint = S3_ENDPOINT.replace('https://', '')
    else:
        is_secure = False
buran write Dec-22-2023, 10:15 AM:
S3 Password replaced with asterisks. Anyway I would replace it if I were you.
buran write Dec-22-2023, 08:04 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Loop through all files in a directory? Winfried 10 443 Apr-23-2024, 07:38 PM
Last Post: FortuneCoins
  Upload Files to Azure Storage Container phillyfa 6 716 Dec-22-2023, 06:11 AM
Last Post: Pedroski55
  change directory of save of python files akbarza 3 907 Jul-23-2023, 08:30 AM
Last Post: Gribouillis
  Using pyinstaller with .ui GUI files - No such file or directory error diver999 3 3,397 Jun-27-2023, 01:17 PM
Last Post: diver999
  Monitoring a Directory for new mkv and mp4 Files lastyle 3 1,660 May-07-2023, 12:33 PM
Last Post: deanhystad
Lightbulb shutdown host from docker container cosmin1805 0 963 Nov-27-2022, 06:34 PM
Last Post: cosmin1805
  networkx package is not visible in singularity container image erdemath 11 2,309 Oct-14-2022, 12:04 PM
Last Post: Larz60+
  Read directory listing of files and parse out the highest number? cubangt 5 2,380 Sep-28-2022, 10:15 PM
Last Post: Larz60+
  python installation/running inside singularity container erdemath 2 1,813 Sep-21-2022, 08:13 AM
Last Post: erdemath
  Python in Singularity Container on Ubuntu erdemath 0 915 Aug-31-2022, 02:17 PM
Last Post: erdemath

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020