コード例 #1
0
        /// <summary>
        /// Compara los ficheros que hay en local con s3 para descargar y subir los que falten
        /// </summary>
        public void CompareFiles()
        {
            S3Management s3m = new S3Management();

            List <string> s3List    = RemoteFiles();
            List <string> localList = LocalFiles();

            List <string> toDownload = new List <string>();
            List <string> toUpload   = new List <string>();

            //archivos de s3 que no están en
            toDownload = s3List.Except(localList).ToList();

            //Ver archivos en local que no están en s3
            toUpload = localList.Except(s3List).ToList();

            //Update files
            foreach (string file in toDownload)
            {
                s3m.DownloadFile(file);
            }

            foreach (string file in toUpload)
            {
                s3m.UploadFile(file);
            }
        }
コード例 #2
0
        /// <summary>
        /// Subir todos los ficheros a S3
        /// </summary>
        public static void UploadFilesToS3()
        {
            
            List<Task> taskList = new List<Task>();

            filesList = LoadFilesOnMemory();

            foreach (FileForS3 item in filesList)
            {

                var task = Task.Factory.StartNew(() => {

                    s3m.UploadFile(item.path);

                });

                taskList.Add(task);

            }

            Task.WaitAll(taskList.ToArray());
            log.Info("All files uploaded to S3.");
            
        }
コード例 #3
0
        public void UploadAFileTest()
        {
            string filePath = @"D:\SistemasDistribuidosS3FolderTest\PrimeraPruebaSubirS3.txt";

            s3m.UploadFile(filePath);
        }