How to export media files from Magento Cloud to local machine?
-
12-03-2021 - |
質問
Is there a way export media files from Magento Cloud to local machine ? I have setup and magento 2 cloud website but I don't get the product images and other media files.
解決
Magento devdoc suggests to use rsync to move media files. https://devdocs.magento.com/guides/v2.3/cloud/live/stage-prod-migrate.html
To migrate static files from your local machine:
Use the rsync command to copy the pub/media directory from your local Magento server to staging or production:
rsync -azvP local_machine/pub/media/ <environment_ssh_link@ssh.region.magento.cloud>:pub/media/
In your case, reverse the rsync source & destination of above command.
他のヒント
You can use magento cloud cli
cli setup : https://devdocs.magento.com/cloud/reference/cli-ref-topic.html
Usage:
magento-cloud scp [-r|--recursive] [-p|--project PROJECT] [--host HOST] [-e|--environment ENVIRONMENT] [-A|--app APP] [--worker WORKER] [-i|--identity-file IDENTITY-FILE] [--] [<files>]...
Arguments:
files Files to copy. Use the remote: prefix to define remote locations.
Options:
-r, --recursive Recursively copy entire directories
-p, --project=PROJECT The project ID or URL
--host=HOST The project's API hostname
-e, --environment=ENVIRONMENT The environment ID
-A, --app=APP The remote application name
--worker=WORKER A worker name
-i, --identity-file=IDENTITY-FILE An SSH identity (private key) to use
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
-y, --yes Answer "yes" to any yes/no questions; disable interaction
-n, --no Answer "no" to any yes/no questions; disable interaction
-v|vv|vvv, --verbose Increase the verbosity of messages
Examples:
Copy local files a.txt and b.txt to remote mount var/files:
magento-cloud scp a.txt b.txt remote:var/files
Copy remote files c.txt to current directory:
magento-cloud scp remote:c.txt .
Copy subdirectory dump/ to remote mount var/files:
magento-cloud scp -r dump remote:var/logs
Copy files inside subdirectory dump/ to remote mount var/files:
magento-cloud scp -r dump/* remote:var/logs
所属していません magento.stackexchange