This topic describes how to run the appendfromfile command to append content to an object that is uploaded by using append upload.
./ossutil64 appendfromfile localfilename oss://bucketname/objectname [--meta ]
The following table describes the parameters that you can configure when you run the appendfromfile command.
|localfilename||The full path of the local file that you want to upload.|
|bucketname||The name of the bucket that stores the object to which you want to append content.|
|objectname||The name of the object to which you want to append content. When you run the appendfromfile command for append upload, you can retain the original name of the local file for the object or specify another name.|
|--meta||The metadata of the object. You can configure this parameter only the first time you
run the appendfromfile command to upload an object. Example:
In the following examples, the appendfromfile command is first used to upload a local file named exampleobject.txt in the root directory to a bucket named examplebucket. Then, the appendfromfile command is used to append content to exampleobject.txt multiple times.
- Run the following command to upload exampleobject.txt, and then 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 specified bucket and the object size is 5 bytes.
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)
- Run the following command to append the content of a file named dest.txt to exampleobject.txt.
If you want to append more content to exampleobject.txt, run the following command and replace dest.txt with the name of the file whose content you want to append to exampleobject.txt:
./ossutil64 appendfromfile dest.txt oss://examplebucket/exampleobject.txt
If a similar output is displayed, the content is appended to exampleobject.txt. The object size 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)
If you use ossutil to switch to a bucket that is located in a different region, you can use the -e option to specify the endpoint of the region in which the specified bucket resides. If you use ossutil to switch to a bucket that belongs to another Alibaba Cloud account, you can use the -i option to specify the AccessKey ID of the specified account, and use the -k option to specify the AccessKey secret of the specified 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.