-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAzcopy
62 lines (43 loc) · 2.33 KB
/
Azcopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Login to Azure/Entra:
azcopy login --tenant-id=<tenant-id> --service-principal
Copy a Single File:
azcopy copy 'C:\local\path\file.txt' 'https://account.blob.core.windows.net/container/path/'
Copy a Directory:
azcopy copy 'C:\local\path\' 'https://account.blob.core.windows.net/container/path/' --recursive
Copy with Patterns:
azcopy copy 'C:\local\path\*.txt' 'https://account.blob.core.windows.net/container/path/'
Additional Copying Options:
--overwrite: Overwrite existing files.
--exclude-pattern: Exclude files matching a pattern.
Sync a Directory:
Synchronize local directories with Blob containers:
azcopy sync 'C:\local\path' 'https://account.blob.core.windows.net/container/path'
Useful flags:
--delete-destination: Determines whether to delete blobs at the destination that don’t exist at the source.
Delete a Blob:
azcopy remove 'https://account.blob.core.windows.net/container/path/file.txt'
Delete with Patterns:
azcopy remove 'https://account.blob.core.windows.net/container/path/*.txt'
Job Management:
AzCopy allows you to manage jobs for ongoing and past operations:
List Jobs:
azcopy jobs list
Show a Job’s Status:
azcopy jobs show <job-id>
Resume a Job:
azcopy jobs resume <job-id>
Advanced Commands and Flags:
AzCopy includes several advanced commands and flags that allow fine-tuning your operations:
--include-pattern: Include only these files when copying, syncing, or removing.
--exclude-pattern: Exclude these files.
--overwrite: Control overwriting behavior.
Blob to Blob:
azcopy copy 'https://mysourceaccount.blob.core.windows.net/mycontainer/myTextFile.txt' 'https://mydestinationaccount.blob.core.windows.net/mycontainer/myTextFile.txt'
Copy a directory:
azcopy copy 'https://mysourceaccount.blob.core.windows.net/mycontainer/myBlobDirectory' 'https://mydestinationaccount.blob.core.windows.net/mycontainer' --recursive
Copy a container:
azcopy copy 'https://mysourceaccount.blob.core.windows.net/mycontainer' 'https://mydestinationaccount.blob.core.windows.net/mycontainer' --recursive
Copy containers, directories, and blobs:
azcopy copy 'https://mysourceaccount.blob.core.windows.net/' 'https://mydestinationaccount.blob.core.windows.net' --recursive
On-Prem to Azure Blob:
azcopy copy "<local-folder-path>" "https://<storage-account-name>.<blob or dfs>.core.windows.net/<container-name>" --recursive=true