logo
Tags down

shadow

What is a better file copy alternative than the Windows default?


By : kwgainey
Date : July 27 2020, 12:00 PM
wish help you to fix your issue How about good old Command-Line Xcopy? With S: being the source and T: the target:
code :
xcopy /K /R /E /I /S /C /H /G /X /Y s:\*.* t:\


Share : facebook icon twitter icon

Is there an open source alternative to Windows Volume Shadow Copy


By : user2428338
Date : March 29 2020, 07:55 AM
Hope that helps I found a Wikipedia entry here and was able to find a Windows XP application here

QFileDialog alternative that uses default file dialog defined by OS?


By : lukep
Date : March 29 2020, 07:55 AM
it fixes the issue I tried using a QFileDialog in a program of mine, but I prefer the default file dialog that is used by the host's OS. In my case, since I use Windows 7, it should look like this: , Use the static functions for it and it will work.
code :
QString filename = QFileDialog::getOpenFileName(this, ... vars);

An alternative find file function with the same default folder, every time


By : D. Hul
Date : March 29 2020, 07:55 AM
wish of those help Just define a command that calls read-file-name with the directory you want as the default (in the interactive spec), and then calls find-file on the file name read.
code :
(defun my-find-file (file)
  "..."
  (interactive (list (read-file-name "File: " "~/x/")))
  (find-file file))

How to give right path in .bat file to copy file from windows server to local windows


By : Shannon Kohl
Date : March 29 2020, 07:55 AM
like below fixes the issue Try this, you will need the admin credentials for the net use though as the C drive is an administrative share
code :
net use N: \\trail01\c$ trail@1234 /USER:ashique.sheikh

XCOPY /Y "N:\Users\ashique.sheikh\Desktop\Day2.R" "D:\newfolder"

Alternative to AzureBlob File Copy on VSTS


By : Hinojosa Maria
Date : March 29 2020, 07:55 AM
hope this fix your issue I have used the AzureBlob File Copy task on VSTS to distribute a client library to azure blob storage that SPA clients consume libraries from aswell as stylesheets. , I ended up creating my own task in c# from some existing code I had.
code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using CommandLine;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
using Newtonsoft.Json.Linq;
using SInnovations.VSTeamServices.TaskBuilder.Attributes;
using SInnovations.VSTeamServices.TaskBuilder.AzureResourceManager.ResourceTypes;
using SInnovations.VSTeamServices.TaskBuilder.ConsoleUtils;
using SInnovations.VSTeamServices.TaskBuilder.ResourceTypes;
using SInnovations.VSTeamServices.TaskBuilder.Tasks;

namespace AzureBlobFileCopy
{

    public class ConnectedServiceRelation : PropertyRelation<ProgramOptions, ServiceEndpoint>
    {
        public ConnectedServiceRelation()
            : base(k => k.ConnectedServiceName)
        {

        }
    }

    [ResourceType(TaskInputType = "pickList")]
    public class ARMListKey : IConsoleReader<ProgramOptions>, IConsoleExecutor<ProgramOptions>
    {
        public void OnConsoleParsing(Parser parser, string[] args, ProgramOptions options, PropertyInfo info)
        {
            Id = args[Array.IndexOf(args, "--storage") + 1];
        }

        public void Execute(ProgramOptions options)
        {
            var http = options.ConnectedServiceName.GetAuthorizedHttpClient("https://management.azure.com/");

            var keys = http.PostAsync($"https://management.azure.com{Id}/listKeys?api-version=2016-01-01", new StringContent(string.Empty)).GetAwaiter().GetResult();
            var keysObj = JObject.Parse(keys.Content.ReadAsStringAsync().GetAwaiter().GetResult());

            Account = new CloudStorageAccount(new StorageCredentials(Id.Split('/').Last(), keysObj.SelectTokens("$.keys[*].value").First().ToString()), true);
        }

        public string Id { get; set; }

        public CloudStorageAccount Account { get; set; }

    }

    [ConnectedServiceRelation(typeof(ConnectedServiceRelation))]
    [EntryPoint("Uploading to $(storage)")]
    [Group(DisplayName = "Output", isExpanded = true, Name = "output")]
    public class ProgramOptions
    {

        [Display(ShortName = "source", Name = "Copy Path", Description = "The files that should be copied", ResourceType = typeof(GlobPath))]
        public GlobPath Source { get; set; }

        [Required]
        [Display(Name = "Azure Subscription", ShortName = "ConnectedServiceName", ResourceType = typeof(ServiceEndpoint), Description = "Azure Service Principal to obtain tokens from")]
        public ServiceEndpoint ConnectedServiceName { get; set; }

        [Required]
        [ArmResourceIdPicker("Microsoft.Storage/storageAccounts", "2016-01-01")]
        [Display(ShortName = "storage", Name = "Storage Account", Description = "The storage account to copy files to", ResourceType = typeof(ARMListKey))]
        public ARMListKey StorageAccount { get; set; }


        [Display(Name = "Container Name")]
        [Option("container", Required = true)]
        public string ContainerName { get; set; }

        [Display(Name = "Prefix for uploaded data")]
        [Option("prefix")]
        public string Prefix { get; set; }

        [Display(Name = "Fail if files Exists")]
        [DefaultValue(true)]
        [Option("failOnExists")]
        public bool FailIfFilesExist { get; set; }

        [Display(Name = "Storage Container Uri", GroupName = "output")]
        [Option("StorageContainerUri")]
        public string StorageContainerUri { get; set; }

        [Display(Name = "Storage Container SAS token", GroupName = "output")]
        [Option("StorageContainerSASToken")]
        public string StorageContainerSASToken
        {
            get; set;
        }


        [Display(Name = "Verbose", Description = "Write out each file thats uploaded")]
        [Option("Verbose")]
        public bool Verbose { get; set; }
    }
    public class Program
    {
        private static readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
        private static readonly ManualResetEvent runCompleteEvent = new ManualResetEvent(false);

        static void Main(string[] args)
        {
#if DEBUG
     //       args = new[] { "--build" };
#endif
            ServicePointManager.UseNagleAlgorithm = true;
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.CheckCertificateRevocationList = true;
            ServicePointManager.DefaultConnectionLimit = ServicePointManager.DefaultPersistentConnectionLimit * 100;

            try
            {

                RunAsync(ConsoleHelper.ParseAndHandleArguments<ProgramOptions>($"Finding and uploading data", args),
                    cancellationTokenSource.Token).Wait();

            }
            finally
            {
                runCompleteEvent.Set();
            }

        }

        private static async Task RunAsync(ProgramOptions ops, CancellationToken cannelcationtoken)
        {

            Console.WriteLine($"Uploading data at {ops.Source} to {ops.StorageAccount.Account.BlobEndpoint} using {ops.Prefix} as prefix in {ops.ContainerName}");

            var client = ops.StorageAccount.Account.CreateCloudBlobClient();

            var container = client.GetContainerReference(ops.ContainerName);

            await container.CreateIfNotExistsAsync();

            if (ops.FailIfFilesExist)
            {
                var uploads = ops.Source.MatchedFiles()
                    .Select(file => Path.Combine(ops.Prefix, file.Substring(ops.Source.Root.Length).TrimStart('/', '\\')).Replace("\\", "/"))
                    .ToLookup(k=>k);

                foreach(var file in container.ListBlobs(ops.Prefix, true).OfType<CloudBlockBlob>().Select(b => b.Name))
                {
                    if (uploads.Contains(file))
                    {
                        Console.WriteLine("##vso[task.logissue type=error] File Exists: " + file);
                        throw new Exception("File exists: " + file);
                    }
                }


            }



            var actionBlock = new TransformBlock<string, Tuple<string, CloudBlockBlob, TimeSpan>>(async (string file) =>
               {
                   var filestopWatch = Stopwatch.StartNew();
                   using (var fileStream = File.OpenRead(file))
                   {
                       var blob = container.GetBlockBlobReference(Path.Combine(ops.Prefix,file.Substring(ops.Source.Root.Length).TrimStart('/','\\')).Replace("\\","/"));
                       blob.Properties.ContentType = Constants.GetContentType(file);

                       using (var writeable = await blob.OpenWriteAsync())
                       {
                           await fileStream.CopyToAsync(writeable);
                       }
                       return new Tuple<string, CloudBlockBlob, TimeSpan>(file, blob, filestopWatch.Elapsed);
                   }

               }, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 64 });

            var i = 0;
            var completed = new ActionBlock<Tuple<string, CloudBlockBlob, TimeSpan>>((blob) =>
             {
                 if (ops.Verbose)
                 {
                     Console.WriteLine($"Uploaded {blob.Item1} to {blob.Item2.Name} completed in {blob.Item3}");
                 }

                 Interlocked.Increment(ref i);
             });

            actionBlock.LinkTo(completed, new DataflowLinkOptions { PropagateCompletion = true });
            var stopWatch = Stopwatch.StartNew(); 
            foreach (var file in ops.Source.MatchedFiles())
            {

                await actionBlock.SendAsync(file);
            }

            actionBlock.Complete();

            await completed.Completion;

            Console.WriteLine($"Uploaded {i} files to {container.Name}{ops.Prefix} in {stopWatch.Elapsed}");


            if (!string.IsNullOrEmpty(ops.StorageContainerUri))
            {
                TaskHelper.SetVariable(ops.StorageContainerUri, container.Uri.ToString());

            }
            if (!string.IsNullOrEmpty(ops.StorageContainerSASToken))
            {
                TaskHelper.SetVariable(ops.StorageContainerSASToken, container.GetSharedAccessSignature(new SharedAccessBlobPolicy
                {
                    SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddHours(2),
                    Permissions = SharedAccessBlobPermissions.Add | SharedAccessBlobPermissions.Create | SharedAccessBlobPermissions.Delete | SharedAccessBlobPermissions.List | SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write
                }),
                     true);
            }

        }
    }
}
Related Posts Related Posts :
  • iterator .end() from std::list returns "0xcdcdcdcdcdcdcdcd" but .begin() as expected
  • Using disabledDate in Antd Datepicker in table
  • how to convert HAC flexible query to DAO query
  • How to make a function to use dict keys as variables to a class?
  • Best approach to remove cassandra-topology.properties file in running cluster nodes
  • Cannot refresh UI if update in ItemView
  • Sum same property object by group
  • plsql store procedure loop compare value
  • Is std::sqrt the same as sqrt in C++
  • Replace values in XML file with values of a vector
  • What do you do about the JLabel classes? It says, "JLabel not a statement" for the error
  • Convert old SQL Database in compatibility mode
  • Why does the overidden run method in java.lang.Thread produce a bizarre output?
  • Iterate through std::initializer_list
  • Typescript: type one parameter based on the other
  • How to add a CSS to this JavaScript or HTML on click buttons?
  • Is it OK to inherit an empty Interface?
  • Functional Interface call for a new Instance
  • Microsoft Bot Framework: Smilies in MS Teams
  • How to convert two arrays of strings to the array of objects like key and value with particular keys in javascript?
  • changing background image of div using javascript
  • What is the fastest way to find if a column has at least one NULL value in ORACLE database?
  • Rename headers - 'list' object is not callable
  • Codeblocks c++ code doesn't run in VS 19 (vector subscript out of range)
  • Passing res.send value from node.js backend to react.js
  • Is it possible to pass data from an angular7 component or service to index.html file?
  • Vim shortcuts to select and copy the current line without the next line
  • When I tried to add ArrayList into ArrayList second ArrayList is repeating
  • If I implement IEquatable<T>, will I lose the option to compare by reference?
  • Authorize with both ASP.NET core MVC/Razor site AND a WebAPI
  • Dynamically generated href won't show properly
  • Does UIWindow function not work in Xcode11.3?
  • Compare two version of zip file and find which file has been modified within that zip
  • Best way to saving completed progress in table?
  • TypeError: __init__() takes 2 positional arguments but 6 were given
  • Converting string (with timezone) to datetime in python
  • How to overwrite the theme in shopify
  • How to keep track of previous value of variable in swift?
  • Can't get result when running the query from Spring Data Jpa
  • Python list generation from two strings
  • If Condition Simplification
  • Get the no of consecutive days a Field value is Stale
  • How to correct TypeError: Unicode-objects must be encoded before hashing with ReportLab
  • How to use data to set other data in Vue.js
  • How to find distinct records in vespa.ai?
  • ASP Net Core Web API: Client side GroupBy is not supported
  • Azure AD does not return groups on claims
  • Why erase on std::vector promote iterator
  • how to destroy an object in C++
  • Can someone explain to me why my factorial recursion code can't be compiled
  • Pass a PHP variable to a JS variable
  • C# I have a DLL file and I need to make a class that inherits from a class that's in the DLL file?
  • How to do pagination using groupby in vespa.ai?
  • How can I print the longest word from a user defined list?
  • [BootstrapVue warn]: popover - Unable to find target element in document
  • Replace substring in shell script
  • Swipe to delete rows with multi section in tableview?
  • enabling authentication in ignite
  • Showing messages based on scroll position
  • How to copy cells via vba macro without getting subscript out of range
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org