public static void getFolderFromAzureToLocalPath()

in SmvCmdlets/GetBugsFolder.cs [65:105]


        public static void getFolderFromAzureToLocalPath(string absolutePath, string sdxRoot, string sessionId, string AzCopyPath, string connectionString, string connectionKey)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
            CloudFileClient fileClient = storageAccount.CreateCloudFileClient();
            CloudFileShare share = fileClient.GetShareReference("smvautomation");
            CloudFileDirectory direc = share.GetRootDirectoryReference();
            absolutePath = absolutePath.ToLower();
            sdxRoot = sdxRoot.ToLower();
            string relativePath = absolutePath.Replace(sdxRoot, "%SDXROOT%");
            string cloudPath = Path.Combine(sessionId, "Logs", relativePath, "Bugs");
            Console.WriteLine(cloudPath);
            CloudFileDirectory dir = direc.GetDirectoryReference(cloudPath);
            absolutePath = Path.Combine(absolutePath, "Bugs");
            if (Directory.Exists(absolutePath))
            {
                Directory.Delete(absolutePath, true);
            }
            if (dir.Exists())
            {
                Process cmd = new Process();
                cmd.StartInfo.FileName = "cmd.exe";
                cmd.StartInfo.RedirectStandardInput = true;
                cmd.StartInfo.RedirectStandardOutput = true;
                cmd.StartInfo.CreateNoWindow = false;
                cmd.StartInfo.UseShellExecute = false;
                cmd.Start();

                string changeLocation = "cd " + AzCopyPath;
                cmd.StandardInput.WriteLine(changeLocation);

                string command = @".\AzCopy.exe /Source:https://smvtest.file.core.windows.net/smvautomation/" + cloudPath + " /Dest:" + absolutePath + " /Sourcekey:" + connectionKey + " /S /Z:" + absolutePath;

                cmd.StandardInput.WriteLine(command);
                cmd.StandardInput.WriteLine("exit");
                cmd.WaitForExit();
            }
            else
            {
                Console.WriteLine("Could not find bugs folder in the location!");
            }
        }