The size and number of files affect the upload efficiency. To accelerate the transfer of large files or multiple files to an Elastic Compute Service (ECS) instance, we recommend that you compress, upload, and then decompress the files or folders. This topic describes how to compress and decompress files or folders and check the integrity of files after you transfer the files.
Solution overview
You can improve the file transfer efficiency in scenarios in which large files and a large number of files are transferred. Tools, such as Workbench, can upload only a single file at a time. You can compress multiple files into a compressed package and upload the package. This way, you can batch upload files.
Procedure
Compress files on your on-premises computer. You can compress the files or folder that you want to upload to an ECS instance into a compressed package in your on-premises operating system.
Upload the compressed package to an ECS instance. You can use a tool to upload the compressed package to the instance. For information about how to select a method to upload files, see Select a file transfer method.
Decompress the files from the compressed package on the ECS instance. After the package is uploaded, decompress files from the package on the ECS instance.
Select a compression tool
You can select an appropriate compression tool to compress files based on the following table.
You can also select a compression tool based on your preference. The following table describes specific compression tools and compression formats.
On-premises operating system | Operating system of the ECS instance | Compressed package format | Compression tool | Compression tutorial | Decompression tutorial |
Windows | Windows | zip | Built-in compression tool | Compress files into a zip package in Windows | Decompress files from a zip package in Windows |
Windows | Linux | tar.gz | 7-Zip | Compress files into a tar.gz package in Windows | Decompress files from a tar.gz package in Linux |
macOS and Linux | Windows | zip | zip (command) | Compress files into a zip package in macOS or Linux | Decompress files from a zip package in Windows |
macOS and Linux | Linux | tar.gz | tar (command) | Compress files into a tar.gz package in macOS or Linux | Decompress files from a tar.gz package in Linux |
Compression tutorials
Compress files into a zip package in Windows
You can use the compression feature that comes with Windows to compress files into a zip package. Perform the following steps.
The interface may vary based on the operating system.
Find the folder or file that you want to compress, right-click the folder or file, and then choose
.After the compression is complete, a compressed package suffixed with .zip is generated next to the folder or file.
Compress files into a tar.gz package in Windows
To compress files into a tar.gz package in Windows, you must install an additional compression tool. In this example, 7-Zip is used.
The procedure may vary based on the compression tool that you use. Adjust the steps based on your compression tool.
Package a folder or file into a tar package.
Find the folder or file that you want to compress, right-click the folder or file, and then choose
. In the Add to Archive dialog box, set the Archive format parameter to tar and click OK. In this step, the folder or file is packaged into a tar package.Compress the tar package into a tar.gz package.
Find the package that you packed in Step 1, right-click the package, and then choose .tar.gz.
. In the Add to Archive dialog box, set the Archive format parameter to gzip and click OK. In this step, the tar package generated in Step 1 is compressed into a compressed package suffixed withAfter the compression is complete, a compressed package suffixed with .tar.gz is generated next to the original tar package.
Compress files into a zip package in macOS or Linux
On a macOS or Linux terminal, run the following command to complete the compression:
zip -r <Package name>.zip <Folder that you want to compress>
For example, to compress the test folder into the test.zip package, run the following command:
zip -r test.zip test
Compress files into a tar.gz package in macOS or Linux
On a macOS or Linux terminal, run the following command to complete the compression:
tar -zcvf <Package name>.tar.gz <Folder that you want to compress>
For example, to compress the test folder into the test.tar.gz package, run the following command:
tar -zcvf test.tar.gz test
Decompression tutorials
Decompress files from a zip package on a Windows instance
On the Windows instance, find the zip package from which you want to decompress files.
Right-click the zip package and select Extract All. In the Extract Compressed (Zipped) Folders dialog box, specify a directory to which you want to decompress the files in the zip package and click Extract. Then, wait until the files are decompressed.
Decompress files from a tar.gz package on a Linux instance
On the Linux instance, go to the directory in which the tar.gz package is stored and run the following command to decompress files from the package:
tar -zxvf <Package name>.tar.gz
For example, to decompress files from a package named test.tar.gz, run the following command:
tar -zxvf test.tar.gz