forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: weihongmin1 <weihongmin1@huawei.com> Co-committed-by: weihongmin1 <weihongmin1@huawei.com>
84 lines
7.7 KiB
HTML
84 lines
7.7 KiB
HTML
<a name="obs_11_0029"></a><a name="obs_11_0029"></a>
|
|
|
|
<h1 class="topictitle1">Download</h1>
|
|
<div id="body1543383727788"><p id="obs_11_0029__p12118334192812">All commands in this section use the Linux operating system as an example to describe how to download files.</p>
|
|
<p id="obs_11_0029__p4927118201719">Assume that bucket <strong id="obs_11_0029__b785561814118">bucket-test</strong> contains the following objects:</p>
|
|
<pre class="screen" id="obs_11_0029__screen776818585566">obs://bucket-test/test1.txt
|
|
obs://bucket-test/test2.txt
|
|
obs://bucket-test/test3.txt
|
|
obs://bucket-test/test4.txt
|
|
obs://bucket-test/test5.txt
|
|
obs://bucket-test/test6.txt
|
|
obs://bucket-test/src1/
|
|
obs://bucket-test/src1/test7.txt
|
|
obs://bucket-test/src2/
|
|
obs://bucket-test/src2/test8.txt
|
|
obs://bucket-test/src2/src3/
|
|
obs://bucket-test/src2/src3/test9.txt</pre>
|
|
<p id="obs_11_0029__p0873101916261">Based on the structure of objects in the bucket, different download scenarios require different commands.</p>
|
|
<ul id="obs_11_0029__ul174731818476"><li id="obs_11_0029__li1830605242615">To download the <strong id="obs_11_0029__b10644143692215">test1.txt</strong> file from bucket <strong id="obs_11_0029__b106981022236">bucket-test</strong> to the local <strong id="obs_11_0029__b7255151910231">src1</strong> folder, the command is as follows:<pre class="screen" id="obs_11_0029__screen1824094893113">./obsutil cp obs://bucket-test/test1.txt /src1</pre>
|
|
<p id="obs_11_0029__p398225316315">After the download is complete, the following file is generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen251512321320"><span style="color:#666600;">└──</span> src1
|
|
<span style="color:#666600;">└──</span> test1.txt</pre>
|
|
</li><li id="obs_11_0029__li116837346319">Run the following command to download the <strong id="obs_11_0029__b12949322173019">test1.txt</strong> file to your local PC. If there is no <strong id="obs_11_0029__b139502022103014">test.txt</strong> on the local PC, the <strong id="obs_11_0029__b209519221304">test1.txt</strong> file is directly downloaded and you can rename it to <strong id="obs_11_0029__b19951132218304">test.txt</strong>. If <strong id="obs_11_0029__b395252293015">test.txt</strong> already exists, <strong id="obs_11_0029__b1495372217305">test1.txt</strong> is downloaded and overwrites the original local <strong id="obs_11_0029__b195316227307">test.txt</strong> file after renaming.<pre class="screen" id="obs_11_0029__screen18345312154212">./obsutil cp obs://bucket-test/test1.txt /test.txt</pre>
|
|
<p id="obs_11_0029__p664518192425">After the download is complete, the following file is generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen719113424214"><span style="color:#666600;">└──</span> test.txt</pre>
|
|
</li><li id="obs_11_0029__li1261911034212">To recursively download the entire <strong id="obs_11_0029__b692395819425">src2</strong> folder from bucket <strong id="obs_11_0029__b20771274471">bucket-test</strong> to the local <strong id="obs_11_0029__b109242582427">src1</strong> folder in force mode, the command is as follows:<pre class="screen" id="obs_11_0029__screen17906155535618">./obsutil cp obs://bucket-test/src2 /src1 -r -f</pre>
|
|
<p id="obs_11_0029__p11605111105719">After the download is complete, the following files are generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen91301738185716"><span style="color:#666600;">└──</span> src1
|
|
<span style="color:#666600;">└──</span> src2
|
|
<span style="color:#666600;"> ├──</span> src3
|
|
<span style="color:#666600;"> └──</span> test9.txt
|
|
<span style="color:#666600;"> └──</span> test8.txt</pre>
|
|
</li><li id="obs_11_0029__li1218311447562">To recursively download all files and subfolders in the <strong id="obs_11_0029__b195612824910">src2</strong> folder from bucket <strong id="obs_11_0029__b759112812491">bucket-test</strong> to the local <strong id="obs_11_0029__b196062812497">src1</strong> folder in force mode, the command is as follows:<pre class="screen" id="obs_11_0029__screen129059169590">./obsutil cp obs://bucket-test/src2 /src1 -r -f -flat</pre>
|
|
<p id="obs_11_0029__p7171129202">After the download is complete, the following files are generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen1565013581502"><span style="color:#666600;">└──</span> src1
|
|
<span style="color:#666600;"> ├──</span> src3
|
|
<span style="color:#666600;"> └──</span> test9.txt
|
|
<span style="color:#666600;">└──</span> test8.txt</pre>
|
|
</li><li id="obs_11_0029__li13172115610584">To recursively download the all objects in bucket <strong id="obs_11_0029__b589718805516">bucket-test</strong> to the local <strong id="obs_11_0029__b1789718845517">src0</strong> folder in force mode, the command is as follows:<pre class="screen" id="obs_11_0029__screen6155127538">./obsutil cp obs://bucket-test /src0 -r -f</pre>
|
|
<p id="obs_11_0029__p1093315343315">After the download is complete, the following files are generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen77316291358"><span style="color:#666600;">└──</span> src0
|
|
<span style="color:#666600;"> ├──</span> test1.txt
|
|
<span style="color:#666600;"> ├──</span> test2.txt
|
|
<span style="color:#666600;"> ├──</span> test3.txt
|
|
<span style="color:#666600;"> ├──</span> test4.txt
|
|
<span style="color:#666600;"> ├──</span> test5.txt
|
|
<span style="color:#666600;"> ├──</span> test6.txt
|
|
<span style="color:#666600;"> ├──</span> src1
|
|
<span style="color:#666600;"> └──</span> test7.txt
|
|
<span style="color:#666600;">└──</span> src2
|
|
<span style="color:#666600;">├──</span> src3
|
|
<span style="color:#666600;"> └──</span> test9.txt
|
|
<span style="color:#666600;"> └──</span> test8.txt</pre>
|
|
</li><li id="obs_11_0029__li2897203195717">Run the following command to exclude the <strong id="obs_11_0029__b1599122866">src2</strong> folder (including all files and folders contained) when downloading the <strong id="obs_11_0029__b10991121662">src1</strong> folder from the <strong id="obs_11_0029__b929020391761">bucket-test</strong> bucket:<pre class="screen" id="obs_11_0029__screen862914360547">./obsutil cp obs://bucket-test/src1/ src1 -exclude "*src1/src2*" -r -f -mf</pre>
|
|
<p id="obs_11_0029__p1167442118577">Four objects are successfully downloaded, and the download information contains <strong id="obs_11_0029__b1726517432060">exclude</strong> and the specific content.</p>
|
|
<pre class="screen" id="obs_11_0029__screen1431438135811">./obsutil cp obs://bucket-test/src1/ src1 -exclude "*src1/src2*" -r -f -mf
|
|
|
|
Parallel: 5 Jobs: 5
|
|
Threshold: 50.00MB PartSize: auto
|
|
VerifyLength: false VerifyMd5: false
|
|
Exclude: *src1/src2*
|
|
Include:
|
|
CheckpointDir: xxxx
|
|
OutputDir: xxxx
|
|
TempFileDir: xxxx
|
|
|
|
[====================================================] 100.00% tps:87.78 ?/s 4/4 2.39KB/2.39KB 223ms
|
|
Succeed count: 4 Failed count: 0
|
|
Succeed bytes: 2.39KB
|
|
Metrics [max cost:147 ms, min cost:77 ms, average cost:56.00 ms, average tps:8.85, transferred size:2.39KB]</pre>
|
|
<p id="obs_11_0029__p163871543121710">After the download is complete, the following files are generated on the local PC:</p>
|
|
<pre class="screen" id="obs_11_0029__screen338744351719"><span style="color:#666600;">└──</span> src1
|
|
<span style="color:#666600;"> ├──</span> src3
|
|
<span style="color:#666600;"> └──</span> test9.txt
|
|
<span style="color:#666600;">└──</span> test7.txt</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_11_0027.html">Common Examples</a></div>
|
|
</div>
|
|
</div>
|
|
|