Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

azcopy always creates a folder structure when uploading files

I have a local directory what needs to be synced to a specific folder to my Azure Blob Storage. Unfortunately azcopy always creates a subfolder in the target directory.

local folder: C:/local/vacation

Uploadfolder: xxx.blob.core.windows.net/files/images/jpg

I want all JPGs that are within the local folder into the upload folder. But azcopy always creates the folder "vacation" in my upload folder :(

This is the code:

$localFolder = "C:/local/vacation"
$targetFolder= "xxx.blob.core.windows.net/files/images/jpg"  (# here is the actual SAS URI)
azcopy copy $localfolder $targetfolder --include-pattern "*.jpg" --recursive=true 
like image 970
Julian Avatar asked Nov 15 '25 08:11

Julian


1 Answers

You can use Sync operation to perform the copy without the directory being created.

azcopy sync "C:\local\vacation" "https://*****.blob.core.windows.net/files/images/jpg/?SAStoken" --include-pattern "*.jpg" --recursive=true

Example:

For the first command as you can see below I ran to sync the jpg files to the destination for the first time , then I added another jpg file in my local machine folder and ran the command for second time it synced the 1 new file to the destination.

enter image description here

enter image description here

The Above highlighted files are present on my local machine directory and when I performed sync they were only copied from local machine to azure and the directory was not created as subfolder.

Reference:

Synchronize with Azure Blob storage by using AzCopy v10

like image 149
AnsumanBal-MT Avatar answered Nov 17 '25 23:11

AnsumanBal-MT