Drush Commands

Last updated on
13 March 2019

Export Drupal Content to a Directory.

drush content-sync:export

Aliases
content-sync:export has 2 aliases:

drush content-sync-export
drush cse

Options
content-sync:export accepts 6 options:

--entity-types
A list of entity type names and bundles separated by commas.
(i.e. user, node.article, node.page)

--uuids
A list of UUIDs separated by commas.

--actions
A list of Actions separated by commas.
Values: update, create, delete

--files
A value option to export media/files.
Values: none, base64, folder

--include-dependencies
Export the content dependencies.

--skiplist
 Skip displaying the change list before proceeding with the export.

Examples

  • Export the entire site content entities; Save files in the content folder defined in settings.php.
drush content-sync:export
  • Export content entities of type user and node; Save files in the content folder defined in settings.php.
drush content-sync:export --entity-types=user,node
  • Export content entities of type node and bundle article; Save files in the content folder defined in settings.php.
drush content-sync:export --entity-types=node.article
  • Export content entities of type file and its base64 data; Save files in the content folder defined in settings.php.
drush content-sync:export --entity-types=file --files=base64
  • Export a content entity with uuid [UUID]; Save the file in the content folder defined in settings.php.
drush content-sync:export --uuids=[UUID]
  • Export a content entity with uuid [UUID] including content dependencies; Save files in the content folder defined in settings.php.
drush content-sync:export --uuids=[UUID] --include-dependencies
  • Export content entities that exist in the active storage but not in the content folder; Save files in the content folder defined in settings.php.
drush content-sync:export --actions=create

Import Drupal Content from a Directory.

drush content-sync:import

Aliases
content-sync:import has 2 aliases:

drush content-sync-import
drush csi

Options
content-sync:import accepts 4 options:

--entity-types
A list of entity type names and bundles separated by commas.
(i.e. user, node.article, node.page)

--uuids
A list of UUIDs separated by commas.

--actions
A list of Actions separated by commas.
Values: update, create, delete

--skiplist
 Skip displaying the change list before proceeding with the export.

Examples

  • Import the entire site content entities from the content folder defined in settings.php.
drush content-sync:import
  • Import content entities of type user and node from the content folder defined in settings.php.
drush content-sync:import --entity-types=user,node
  • Import content entities of type node and bundle article from files in the content folder defined in settings.php.
drush content-sync:import --entity-types=node.article
  • Import content entities of type file from files in the content folder defined in settings.php.
    If there is a 'files' folder inside the content folder, then the file will be copied to the correct location.
    If the file includes base64 data, then the file (i.e. image) will be created.
drush content-sync:import --entity-types=file
  • Import a content entity with uuid [UUID] from the file in the content folder defined in settings.php.
drush content-sync:import --uuids=[UUID]
  • Import content entities that exist in the content folder but not in the active storage.
drush content-sync:import --actions=create

Help improve this page

Page status: No known problems

You can: