The appendfromfile command is used to append content to the end of objects that are uploaded by using the AppendObject operation.
- The commands described in this topic apply to 64-bit Linux systems. To use the commands in the following examples in 64-bit Windows systems, replace ./ossutil64 in the commands with ossutil64.exe.
- For more information about append upload, see Append upload.
./ossutil64 appendfromfile local_file_name oss://bucket_name object_name [--meta ]
The following table describes the options you can configure in the command.
|local_file_name||The complete path of the file you want to upload.|
|bucket_name||The name of the bucket in which the object you want to append is stored.|
|object_name||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 file or specify another name.|
|--meta||Configures the metadata of the uploaded object. This option is supported only when
the appendfromfile command is used to upload an object for the first time. Example:
In the following examples, the file named exampleobject.txt in the root directory is uploaded for the first time to a bucket named examplebucket by using append upload Then, append upload is used to append content to exampleobject.txt multiple times.
- Run the following command to upload the file named exampleobject.txt and set the ACL
of the uploaded object to private:
./ossutil64 appendfromfile exampleobject.txt oss://examplebucket/exampleobject.txt --meta "x-oss-object-acl:private"
If the following results are displayed, it indicates that exampleobject.txt is uploaded to the 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)
- Run the following command to append the content of the file named dest.txt to exampleobject.txt.
If you want to append more content to exampleobject.txt, run the following command but with dest.txt changed to file name whose content you want to append to exampleobject.txt.
./ossutil64 appendfromfile dest.txt oss://examplebucket/exampleobject.txt
If the following results are displayed, it indicates that 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)
To use ossutil to manage buckets in different regions, add the -e option followed by the endpoint of the region in which the bucket resides To use ossutil to manage buckets 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.
./ossutil64 appendfromfile exampleobject.txt oss://examplebucket/exampleobject.txt -e shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA**** -k 67DLVBkH7EamOjy2W5RVAHUY9H****
For more information about other common options that apply to the appendfromfile command, see Common options.