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
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.


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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With