Browse Source

List files in data test folder

Only one level for now.
DricomDragon 4 years ago
parent
commit
f1d6577840
1 changed files with 7 additions and 1 deletions
  1. 7 1
      boto-updater.py

+ 7 - 1
boto-updater.py

@@ -1,7 +1,8 @@
 import boto3
+import os.path
 
 # Arguments
-folder_to_sync = './test/data'
+folder_to_sync = './test/data/'
 bucket_target = 'my-bucket'
 
 # Main
@@ -9,3 +10,8 @@ s3 = boto3.client('s3', use_ssl=False, endpoint_url="http://172.17.0.2:9000", aw
 
 # Upload
 res = s3.upload_file('./test/data/hello.txt', bucket_target, 'coucou.txt')
+
+# Get file list
+# Source : https://stackoverflow.com/questions/3207219/how-do-i-list-all-files-of-a-directory
+listOfFiles = [f for f in os.listdir(folder_to_sync) if os.path.isfile(folder_to_sync + f)]
+print(listOfFiles)