drush
drush copied to clipboard
Document `drush archive:dump --exclude-code-paths`, or fix?
Existing document
$ drush archive:dump -h
Backup your code, files, and database into a single file.
The following paths would be excluded from a code archive:
- .git
- vendor
- [docroot]/sites/@/[email protected]
- Drupal files directory
- Composer packages installed paths (`composer info --path --format=json`)
The following directories would be excluded from a file archive:
- css
- js
- styles
- php
Examples:
drush archive:dump Create a site archive file in a temporary directory containing code, database
and Drupal files.
drush archive:dump Create /path/to/archive.tar.gz file containing code, database and Drupal files.
--destination=/path/to/archive.tar.gz
drush archive:dump Create (or overwrite if exists) /path/to/archive.tar.gz file containing code,
--destination=/path/to/archive.tar.gz --overwrite database and Drupal files.
drush archive:dump --code Create /path/to/archive.tar.gz file containing the code only.
--destination=/path/to/archive.tar.gz
drush archive:dump Create /path/to/archive.tar.gz file containing code, database and Drupal files
--exclude-code-paths=foo_bar.txt,web/sites/.+/setting but excluding foo_bar.txt file and settings.php files if found in web/sites/*
s.php --destination=/path/to/archive.tar.gz subdirectories.
drush archive:dump --extra-dump=--no-data Create /path/to/archive.tar.gz file and pass extra option to
--destination=/path/to/archive.tar.gz mysqldump command.
drush archive:dump --files Create /path/to/archive.tar.gz file containing the Drupal files only.
--destination=/path/to/archive.tar.gz
drush archive:dump --database Create /path/to/archive.tar.gz archive file containing the database dump only.
--destination=/path/to/archive.tar.gz
Options:
--code Archive codebase.
--files Archive Drupal files.
--db Archive database SQL dump.
--destination=DESTINATION The full path and filename in which the archive should be stored. Any relative path
will be calculated from Drupal root (usually web for
drupal/recommended-project projects). If omitted, it will be saved to the configured
temp directory.
--overwrite Overwrite destination file if exists.
--description=DESCRIPTION Describe the archive contents.
--tags=TAGS Add tags to the archive manifest. Delimit several by commas.
--generator=GENERATOR The generator name to store in the MANIFEST.yml file. The default is "Drush
archive-dump".
--generatorversion=GENERATORVERSION The generator version number to store in the MANIFEST file. The default is Drush
version.
--exclude-code-paths=EXCLUDE-CODE-PATHS Comma-separated list of paths (or regular expressions matching paths) to exclude from
the code archive.
--extra-dump=EXTRA-DUMP Add custom arguments/options to the dumping of the database (e.g.
mysqldump command).
--convert-symlinks Replace all symlinks with copies of the files/directories that they point to. Default
is to only convert symlinks that point outside the project root.
--skip-tables-key=SKIP-TABLES-KEY A key in the $skip_tables array. @see [Site aliases](../site-aliases.md)
--structure-tables-key=STRUCTURE-TABLES-KEY A key in the $structure_tables array. @see [Site aliases](../site-aliases.md)
--tables-key=TABLES-KEY A key in the $tables array.
--skip-tables-list=SKIP-TABLES-LIST A comma-separated list of tables to exclude completely.
--structure-tables-list=STRUCTURE-TABLES-LIST A comma-separated list of tables to include for structure, but not data.
--tables-list=TABLES-LIST A comma-separated list of tables to transfer.
--database[=DATABASE] The DB connection key if using multiple connections in settings.php. [default:
default]
--db-url=DB-URL A Drupal 6 style database URL. For example
mysql://root:pass@localhost:port/dbname
--target[=TARGET] The name of a target within the specified database connection. [default:
default]
--show-passwords Show password on the CLI. Useful for debugging.
Global options:
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
-y, --yes Auto-accept the default for all user prompts. Equivalent to --no-interaction.
-l, --uri=URI A base URL for building links and selecting a multi-site. Defaults to https://default.
To see all global options, run `drush topic` and pick the first choice.
Aliases: ard
https://www.drush.org/latest/commands/archive_dump/
What are you attempting to do
I want to create an archive in DDEV, excluding the content of the folder web/sites/default/files as well as sub-folders.
The documentation says:
--exclude-code-paths=EXCLUDE-CODE-PATHS Comma-separated list of paths (or regular expressions matching paths) to exclude from
the code archive.
... so I try this, but all content in web/sites/default/files and subfolders are still included:
$ drush archive:dump --exclude-code-paths=/var/www/html/web/sites/default/files/.+ --destination=../my-backup_`date +"%Y_%m_%d"`.tar.gz -v
In what way is the existing documentation unclear or incomplete
I try to supply full path, and use a regular expression, but it seems to not work ...
What should the documentation say instead?
- Check if the documentation is correct, and if not update it. It would be great with an example, which ignores
web/sites/default/filesand sub-folders, since that's a common scenario. - If it's a bug, fix it.