private static void UploadFiles() { if (_filesToUpload == null) { return; } AmazonS3Helper amazonClient = new AmazonS3Helper(_settings.AwsKeyPublic, _settings.AwsKeySecret, _settings.AwsKeyBucket); foreach (var fileToUpload in _filesToUpload) { String filename = Path.GetFileName(fileToUpload); Console.WriteLine("Uploading: {0}", fileToUpload); amazonClient.UploadComplete += AmazonClientOnUploadComplete; _uploadInProgress = true; amazonClient.UploadFile(filename, fileToUpload); while (_uploadInProgress) { System.Threading.Thread.Sleep(1000); } Console.WriteLine("Upload Complete!"); // Delete file after it has been uploaded. File.Delete(fileToUpload); Console.WriteLine("Deleted local backup."); } }