1

I'm doing a command line backup of the file system with bin/magento setup:backup --code,

but I have one directory which contains a lot of large image files that I would like to exclude.

Is there a way to configure my file system backups to exclude a directory?

1 Answer 1

2

Magento module named module-backup having such feature. You can add the directory which you would like to ignore in the following file.

  1. <magento-root>\vendor\magento\module-backup\Helper\Data.php

  2. Look for the method named getBackupIgnorePaths in Data.php

  3. After the below line:

    $this->_filesystem->getDirectoryRead(DirectoryList::VAR_DIR)->getAbsolutePath('report'),

add below line of code and replace directory of your choice. I have assumed <magento-root>\pub\large_image directory.

$this->_filesystem->getDirectoryRead(DirectoryList::PUB)->getAbsolutePath('large_image'),

Take directory constants (DirectoryList::PUB or DirectoryList::VAR_DIR) from the <magento-root>\vendor\magento\framework\App\Filesystem\DirectoryList.php

As this is public function so you can make override by adding plugin into this. Do not make direct any changes in the vendor directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.