Drupal is a registered trademark of Dries Buytaert
drupal 10.6.12 Update released for Drupal core (10.6.12)! drupal 11.3.13 Update released for Drupal core (11.3.13)! drupal 10.6.11 Update released for Drupal core (10.6.11)! drupal 11.3.12 Update released for Drupal core (11.3.12)! drupal 11.2.14 Update released for Drupal core (11.2.14)! drupal 10.5.12 Update released for Drupal core (10.5.12)! cms 2.1.3 Update released for Drupal core (2.1.3)! drupal 10.5.11 Update released for Drupal core (10.5.11)! drupal 11.3.11 Update released for Drupal core (11.3.11)! drupal 11.2.13 Update released for Drupal core (11.2.13)! drupal 10.6.10 Update released for Drupal core (10.6.10)! cms 2.1.2 Update released for Drupal core (2.1.2)! drupal 11.1.10 Update released for Drupal core (11.1.10)! drupal 10.5.10 Update released for Drupal core (10.5.10)! drupal 10.4.10 Update released for Drupal core (10.4.10)! drupal 11.2.12 Update released for Drupal core (11.2.12)! drupal 11.3.10 Update released for Drupal core (11.3.10)! drupal 10.6.9 Update released for Drupal core (10.6.9)! drupal 10.6.8 Update released for Drupal core (10.6.8)! drupal 11.3.9 Update released for Drupal core (11.3.9)!

fs_cli

Security covered
View on drupal.org
File System to CLI (fs_cli)

File System to CLI exposes Drupal's file system API as a small set of Drush commands, so you can inspect and manipulate files from the command line and from automation.

Every command runs through Drupal's file_system service rather than touching the disk directly. That means operations honor Drupal stream wrappers: public://, private://, temporary://, and remote backends such as s3:// (via the S3 File System module). A script behaves the same whether the files live on local disk or in object storage.

Each command returns machine-readable JSON. This makes the module a good fit for deployment pipelines, CI jobs, and infrastructure tooling that needs to act on the result of a file operation without writing custom PHP.

Requirements

  • Drupal 10 or 11.
  • Drush 12 or newer.

Installation

Install with Composer, then enable the module:

composer require drupal/fs_cli
drush pm:enable fs_cli

No configuration is required.

Commands

Command Alias Description fs:file-exists fs-fe Report whether a file exists. fs:directory-exists fs-de Report whether a directory exists. fs:copy [replace] Copy a file, creating the destination directory if needed. fs:move [replace] Move a file, creating the destination directory if needed. fs:mkdir Create a directory. fs:scan-dir List the files in a directory that match a regular-expression mask. fs:delete-dir Delete a directory and its contents recursively.

All commands accept a --format option (default json).

For fs:copy and fs:move, the optional replace argument controls what happens when the destination already exists:

  • 0 — rename: append an incrementing numeric suffix until the name is unique.
  • 1 — replace the existing file (default).
  • 2 — do nothing and return an error.

Examples

# Check whether a file exists on the public file system.
drush fs:file-exists public://logo.png

# Copy a file to S3-backed storage (with S3 File System configured).
drush fs:copy public://export.csv s3://backups/export.csv

# List every JPEG file under a directory.
drush fs:scan-dir public://images '/\.jpg$/'

# Create a working directory and remove it afterwards.
drush fs:mkdir temporary://build
drush fs:delete-dir temporary://build

Maintainers

  • Marco Primitivo (Bladedu)

Sponsored by SparkFabrik.

Activity

Total releases
1
First release
Jun 2026
Latest release
9 hours ago
Release cadence
Stability
100% stable

Releases

Version Type Release date
1.0.0 Stable Jun 26, 2026