This topic describes how to run the appendfromfile command to append content to objects that are uploaded by calling the AppendObject operation.

Notice
  • Sample command lines in this topic are based on the 64-bit Linux system. For other systems, replace ./ossutil64 in the commands with the corresponding binary name. For more information, see ossutil.
  • For more information about append upload, see Append upload.

Command syntax

./ossutil64 appendfromfile localfilename oss://bucketname objectname [--meta ]

The following table describes the parameters that you can configure when you run this command to append content to objects that are uploaded by calling the AppendObject operation.

Parameter Description
localfilename The full path of the local file you want to upload.
bucketname The name of the bucket in which the object you want to append is stored.
objectname The name of the object to which you want to append content. When you upload an object, you can retain the original name of the uploaded local file for the object or specify another name.
--meta Configure the metadata of the uploaded object. This parameter is supported only the first time the appendfromfile command is run to upload an object. Example: --meta "x-oss-object-acl:private".

After the metadata of an object is configured, you can run the set-meta command to modify the metadata of the object.

Examples

In the following examples, the local file named exampleobject.txt in the root directory is uploaded for the first time to a bucket named examplebucket. Then, append upload is used to append content to exampleobject.txt multiple times.

  1. You can run the following command to upload the file named exampleobject.txt and set the access control list (ACL) of the uploaded object to private:
    ./ossutil64 appendfromfile exampleobject.txt oss://examplebucket/exampleobject.txt --meta "x-oss-object-acl:private"

    If a similar output is displayed, exampleobject.txt is uploaded to the destination bucket and is 5 bytes in size:

    total append 5(100.00%) byte,speed is 0.00(KB/s)
    local file size is 5,the object new size is 5,average speed is 0.04(KB/s)
  2. You can run the following command to append the content of the file named dest.txt to exampleobject.txt.

    If you want to append additional content to exampleobject.txt, run the following command but replace dest.txt with the file name whose content you want to append to exampleobject.txt:

    ./ossutil64 appendfromfile dest.txt oss://examplebucket/exampleobject.txt

    If a similar output is displayed, content is appended to exampleobject.txt. The size of exampleobject.txt becomes 150 bytes after the append upload.

    total append 150(100.00%) byte,speed is 0.00(KB/s)
    local file size is 150,the object new size is 150,average speed is 1.19(KB/s)

Common options

When you use ossutil to manage buckets that are located in different regions, you can add the -e option to use the endpoint of the region in which the specified bucket is located. To use ossutil to manage buckets that are owned by different Alibaba Cloud accounts, add the -i option to commands to use the AccessKey ID of the specified Alibaba Cloud account and add the -k option to use the AccessKey secret of the specified Alibaba Cloud account.

For example, you can run the following command to use append upload to upload an object named exampleobject.txt to a bucket named examplebucket, which is located in the China (Shanghai) region and is owned by another Alibaba Cloud account:
./ossutil64 appendfromfile exampleobject.txt oss://examplebucket/exampleobject.txt -e shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA****  -k 67DLVBkH7EamOjy2W5RVAHUY9H****

For more information about other options that you can use for the appendfromfile command, see Common options.