azcopy_linux_amd64_10.0.4
Linux
azcopy cp system/file/path/app/drop "https://myaccount.file.core.windows.net/myfileshare?SASToken" --recursive=true
I would like to copy the contents of the directory (e.g. drop) to the file share but not the containing directory itself (i.e. copy the contents of the directory to the root of the storage location) .
Desired: https://myaccount.file.core.windows.net/myfileshare/ (files within drop)
Occurring: https://myaccount.file.core.windows.net/myfileshare/drop/ (files within drop)
Try and copy the contents of a local directory with files and subdirectories to the root location of your storage account without the parent (or containing directory) also being copied over to the file share.
Not yet - was seeking input on this use case and if there was an option not to copy the parent directory into the destination file system structure.
Hi @woodwardmatt, thanks for reaching out.
Please change the source to: system/file/path/app/drop/*.
For more information, please view the examples by invoking the help command: azcopy copy --help.
Hey @zezha-msft that was what I tried first but seemed to get an error about the number of arguments being supplied (I'm OOTO at the moment, but can update this thread with the error when I'm back at my desk).
When I compared the approach to the examples, the use cases didn't seem to line up. So I thought I'd better ask here :)
Hi @woodwardmatt, thanks for the clarification. I forgot to mention that the arguments should be quoted, like so: "system/file/path/app/drop/*". Otherwise, the shell (depending on your environment) would expand the pattern into a list of files, which is undesired.
Awesome thank you! I'll give that a test soon and confirm :)
@zezha-msft that did the trick!! :)
Couple of things to feedback:
Thanks for your help!
This doesn't seem to work with the sync command. even when using ./source/* it makes a new directory under destination.
Hi @shaunakv1, could you please clarify your use case?
Please consider posting a new issue.
Hi @zezha-msft my use case and issue is pretty much the same as that in the original question except am using sync.
I have a container called $web I need to use for static hosting. Now it will host multiple sites and not just one sites.
So the storage account structure is something like :
---- $web
|
---- site_1
|
---- site_2
|
---- site_3
We use a CI server to deploy the sites right now that we are trying to migrate to azure blob storage static hosting. As the sites can be fairly big, we want to use azcopy sync instead of azcopy cp.
Currently if I use the command like so:
azcopy sync "./site1/*" "https://dummysample.blob.core.windows.net/\$web/site_1/?TOKEN" --recursive=true --force
This creates a new site_1/site_1/<contents> instead of updating site_1/<contents> in the storage
Hi @shaunakv1, thanks for reaching out!
You could use azcopy sync "./site1" "https://dummysample.blob.core.windows.net/\$web/site_1?TOKEN" --recursive=true --force. This should sync the contents of the local directory with the virtual directory on the Blob service.
It does, if the container is empty or there is no virtual directory called site_1. If I run the same command like you said twice, it creates a $web/site_1/site_1 inside the virtual directory.
How do I escape if the src is a blob storage and destination is a on premise and I don't need to copy the container name instead just copy files undernerath it where src is blob and dest is on premise url ---- $result = .\azcopy copy $srcSASURL $destFolder --recursive=true --log-level="ERROR" --include-pattern=$uploadItem --output-type='json' --overwrite="ifSourceNewer"
Answer - Looks like if I change to sync it works as expected.
Something like this should work (if I understand your question properly)
azcopy copy https:\\account.blob.core.windows.net\container\*?SAS destfolder
Note the * just before the ? in the URL.
John, yes this worked. Thanks.