This topic provides examples of how to download objects with common tosutil commands on macOS.
Example bucket and example objects
The example bucket is named bucketname and contains the following objects:
Common examples
The following commands illustrate various download scenarios based on the objects of the example bucket.
Download an object from a bucket to a local folder
Download the file1.txt object from the bucketname bucket to the local folder1 folder
After the download is complete, the following file will be generated on your local device:
Download an object from the bucket to a local folder and rename it
Download the file1.txt object from the bucketname bucket to the local folder1 folder and rename it to file1_renamed.txt
tip
If file1_renamed.txt does not exist in the local folder1 folder, the file will be downloaded and saved directly as file1_renamed.txt. If file1_renamed.txt already exists, the download will overwrite it with the contents of file1.txt.
After the download is complete, the local file will be:
Download a folder (including the folder itself) from a bucket
Download all objects and subfolders in the folder2 folder (including the folder itself) from the bucketname bucket to the local folder1 folder:
After the download is complete, the following files and folders will be generated on your local device:
Download a folder (excluding the folder itself) from a bucket
Download all objects and subfolders in the folder2 folder (excluding the folder itself) from the bucketname bucket to the local folder2_renamed folder:
After the download is complete, the following files and folders will be generated on your local device:
Download all objects in a bucket
Download all objects from the bucketname bucket to the folder0 folder
After the download is complete, the following files and folders will be generated on your local device:
Download objects that meet the specified conditions from a bucket
Download all .txt and pi?1.png objects from the bucketname bucket to the folder0 folder
After the download is complete, the following files and folders will be generated on your local device: