Azure-storage-azcopy: AzCopy sync function deletes files on target when does nto exist in source

Created on 4 Dec 2018  路  6Comments  路  Source: Azure/azure-storage-azcopy

Which version of the AzCopy was used? v10

Note: The version is visible when running AzCopy without any argument

Which platform are you using? (ex: Windows, Mac, Linux) Windows

What command did you run? AzCopy sync

Note: Please remove the SAS to avoid exposing your credentials. If you cannot remember the exact command, please retrieve it from the beginning of the log file.

What problem was encountered? AzCopy sync function deletes the files on the target which do not exist on source. The older version of AzCopy had the option of /xo which does not delete the files on the target folder.

How can we reproduce the problem in the simplest way?

Have you found a mitigation/solution?

Most helpful comment

My 2 cents: (What do others think ?)

  • There should be a command line option to disable deletion of files in the destination
  • The default option should be 'confirm'. AzCopy should prompt the user on whether the user wants to delete the files in the destination. I believe this is already working.
  • There should be a force delete option where AzCopy deletes the files in the destination without prompting at all

All 6 comments

That is right. However AzCopy will prompt you asking whether you want to delete the files in the destination. You can say no to it, and it won't delete then. Has it not asked you the question ?

I could not see the option as it was still scanning unnecessary files on destination.Also we have this automated through job so not sure how would you have the option as No instead of yes as we are forcing all prompts to be suppressed.
For ex: I use below wherein this is a new folder on source so I would want this to be created in Destination and copy all files under that folder but the sync is comparing all the files in the container and not just that specific container. This used to work well with /xo
.azcopy sync "C:UserskdlqDesktopTestAzCopy" "https://.blob.core.windows.net/?" --recursive

This ticket could be considered only for retaining as is /xo functionality. The real issue is it should not deleted all the files on destination. Also it should scan the right set of files when sync is done. Refer to the attachment for our folder structure wherein files could be overwritten for previous days and the updates needs to be synched on cloud.

@artemuwka please help clarify what is the desired behavior (with respect to the /xo).

My 2 cents: (What do others think ?)

  • There should be a command line option to disable deletion of files in the destination
  • The default option should be 'confirm'. AzCopy should prompt the user on whether the user wants to delete the files in the destination. I believe this is already working.
  • There should be a force delete option where AzCopy deletes the files in the destination without prompting at all

Hi @seguler and @jiteshkumargouthamchand These suggestions have been implemented. Thanks!

Was this page helpful?
0 / 5 - 0 ratings