How to Avoid the Prompts While Using Azcopy on Linux in a Script

How do I avoid the prompts while using azcopy on Linux in a script?

Please try azcopy with the --quiet option.

If you type azcopy --help, you will see this option with the following description:

--quiet              Suppresses all AzCopy confirmation prompts.

AzCopy upload file for Linux

We can use this script to upload single file with Azcopy(Linux):

azcopy \
--source /mnt/myfiles \
--destination https://myaccount.file.core.windows.net/myfileshare/ \
--dest-key <key> \
--include abc.txt

Use --include to specify which file you want to upload, here a example, please check it:

root@jasonubuntu:/jason# pwd
/jason
root@jasonubuntu:/jason# ls
test1

root@jasonubuntu:/jason# azcopy --source /jason/ --destination https://jasondisk3.blob.core.windows.net/jasonvm/ --dest-key m+kQwLuQZiI3LMoMTyAI8K40gkOD+ZaT9HUL3AgVr2KpOUdqTD/AG2j+TPHBpttq5hXRmTaQ== --recursive --include test1
Finished 1 of total 1 file(s).
[2017/11/20 07:45:57] Transfer summary:
-----------------
Total files transferred: 1
Transfer successfully: 1
Transfer skipped: 0
Transfer failed: 0
Elapsed time: 00.00:00:02
root@jasonubuntu:/jason#

More information about Azcopy on Linux, please refer to this link.

AzCopy copy run from a batch file in Windows command prompt failure

You need to escape the special characters in your batch file. See a similar question here: Batch character escaping

Journal folder in azcopy for linux

Per document here, please use --resume option to specify a custom location for the journal file.

If you want to specify a custom location for the journal file:

azcopy \
--source /mnt/myfiles \
--destination https://myaccount.blob.core.windows.net/mycontainer \
--dest-key key \
--resume "/mnt/myjournal"

How to handle AZcopy failed file transfers

If the transfer job error is not resulted from the sas token or authentication, you could try below command line from this link.

Show the error message of the failed job:

azcopy jobs show <job-id> --with-status=Failed

Sample Image

Fix them,then execute resume command:

azcopy jobs resume <job-id> --source-sas="<sas-token>"
azcopy jobs resume <job-id> --destination-sas="<sas-token>"

Please refer to the statement of above command:

When you resume a job, AzCopy looks at the job plan file. The plan
file lists all the files that were identified for processing when the
job was first created. When you resume a job, AzCopy will attempt to
transfer all of the files that are listed in the plan file which
weren't already transferred.

Using AzCopy for export table to blob storage in Linux

Azcopy on linux does not support Azure table storage. For more details, please refer to here and here

Sample Image
Sample Image

If you want to use the azcopy to export Azure table, we need to use the azopy V7 on windows. For more details, please refer to here

Regarding how to do that, please refer to here

For example

  1. Install Azcopy

  2. Script

azcopy /Source:https://andyprivate.table.core.windows.net/log /Dest:https://andyprivate.blob.core.windows.net/copy/tablelog /SourceKey:<key> /DestKey:<key> /PayloadFormat:CSV

Sample Image
Sample Image

Besides, if your Azure table is very big, I suggest you use Azure data factory. Regarding how to do that, please refer to the official document and the official document.



Related Topics



Leave a reply



Submit