All commands in this section use the Linux operating system as an example to describe how to download files.
Assume that bucket bucket-test contains the following objects:
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
Based on the structure of objects in the bucket, different download scenarios require different commands.
./obsutil cp obs://bucket-test/test1.txt /src1
After the download is complete, the following file is generated on the local PC:
└── src1 └── test1.txt
./obsutil cp obs://bucket-test/test1.txt /test.txt
After the download is complete, the following file is generated on the local PC:
└── test.txt
./obsutil cp obs://bucket-test/src2 /src1 -r -f
After the download is complete, the following files are generated on the local PC:
└── src1 └── src2 ├── src3 └── test9.txt └── test8.txt
./obsutil cp obs://bucket-test/src2 /src1 -r -f -flat
After the download is complete, the following files are generated on the local PC:
└── src1 ├── src3 └── test9.txt └── test8.txt
./obsutil cp obs://bucket-test /src0 -r -f
After the download is complete, the following files are generated on the local PC:
└── src0 ├── test1.txt ├── test2.txt ├── test3.txt ├── test4.txt ├── test5.txt ├── test6.txt ├── src1 └── test7.txt └── src2 ├── src3 └── test9.txt └── test8.txt
./obsutil cp obs://bucket-test/src1/ src1 -exclude "*src1/src2*" -r -f -mf
Four objects are successfully downloaded, and the download information contains exclude and the specific content.
./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]
After the download is complete, the following files are generated on the local PC:
└── src1 ├── src3 └── test9.txt └── test7.txt