How to say no to all “do you want to overwrite” prompts in a batch file copy?

后端 未结 14 1271
感动是毒
感动是毒 2020-12-23 11:36

By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location.

You can add \"/Y\" to say \"Yes to all\" re

14条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 12:06

    Thanks for this. I am using the command line utility AzCopy (v 3.1.0.93) to move ~1 million files from my local PC to my Azure blob storage. I've got some duplicates and cannot babysit the copy to answer each prompt and don't want to re-upload the same file.

    The AzCopy utility offers a /Y command to suppress the confirmation prompts but ends up telling it to overwrite the destination file. Going this route I was able to get it to NOT re-upload the file. However, it does seem like a bit of a hack since it is not actually answering the prompt with "No", instead I get the error "No input is received when user needed to make a choice among several given options." but does not upload the file.

    Here is the command I used: echo n | AzCopy /Source:"{file path}" /Dest:"{blob storage URL}" /DestKey:{key}

    Hope this helps the next guy.

提交回复
热议问题