'latest', 'region' => 'sa-east-1', 'endpoint' => 'https://s3.infra.flowdat.com/minio/login', 'use_path_style_endpoint' => true, 'credentials' => [ 'key' => 'iksop', 'secret' => '8htoiwn44g204th', ], ]); $head = shell_exec('git rev-parse HEAD'); $head = substr($head,0,-1); $directorioA = array('01_login/','02_base/','03_ftth/','04_map/'); for ($i = 0; $i < 4; $i++) { $dir = $directorioA[$i]; $directorio = opendir("./tests/_output/debug/" . $head . "/" . $dir); while ($archivo = readdir($directorio)) { if (is_dir($archivo)) { } else { $result = $s3->putObject(array( 'Bucket' => 'testbucket', 'Key' => $head.'/'.$dir . $archivo, 'SourceFile' => './tests/_output/debug/'. $head . "/" . $dir . $archivo )); // We can poll the object until it is accessible $s3->waitUntil('ObjectExists', array( 'Bucket' => 'testbucket', 'Key' => $head.'/'.$dir . $archivo )); } } echo "Directorio '" . $dir . "' actualizado. Commit: " . $head . "\n" ; } //descargar HEAD~1 $s3 = new Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'sa-east-1', 'endpoint' => 'https://s3.infra.flowdat.com/minio/login', 'use_path_style_endpoint' => true, 'credentials' => [ 'key' => 'iksop', 'secret' => '8htoiwn44g204th', ], ]); $head1 = shell_exec('git rev-parse HEAD~1'); $head1 = substr($head1,0,-1); for ($i = 0; $i < 4; $i++) { $dir = $directorioA[$i]; shell_exec('mkdir -p ./tests/to_compare/' . $head1 . "/" . $dir); } $iterator = $s3->getIterator('ListObjects', array('Bucket'=> "testbucket",'Prefix'=> $head1)); foreach ($iterator as $object) { //     echo $object['Key']; $retrive = $s3->getObject([ 'Bucket' => 'testbucket', 'Key' => $object['Key'], 'SaveAs' => './tests/to_compare/' . $object['Key'] ]); echo "Se descargó el archivo " . $object['Key'] . "\n"; } } }