Skip to main content
drupalreleases
Release: Cms 2.2.3 — Update released for Drupal core (2.2.3)! Release: Easy Breadcrumb 2.0.11 — Minor update available for module easy_breadcrumb (2.0.11). Release: Bootstrap 8.x-3.42 — Minor update available for theme bootstrap (8.x-3.42). Release: Search API attachments 10.0.13 — Minor update available for module search_api_attachments (10.0.13). Release: Editoria11y Accessibility Checker 3.0.10 — Minor update available for module editoria11y (3.0.10). Release: Editoria11y Accessibility Checker 2.2.24 — Minor update available for module editoria11y (2.2.24). Release: Mismatched entity and/or field definitions 1.2.1 — Minor update available for module meaofd (1.2.1). Release: Lupus Custom Elements Renderer 2.8.1 — Minor update available for module lupus_ce_renderer (2.8.1). Module Revived: Bootstrap 8.x-3.41 — Theme bootstrap updated after 6 months of inactivity (8.x-3.41). Security Coverage: Component Library — Module component_library now has official Drupal security advisory coverage.

File System to Cli

11 sites Security covered Drupal 10–11
View on drupal.org

This module provides Drush commands to manage files in Drupal, allowing you to inspect and manipulate them from the command line. It works with Drupal's stream wrappers, supporting various storage locations like local disk or S3, and outputs results in machine-readable JSON for automation.

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.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Feb 2024
Latest release
3 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.0 Stable 10–11 Jun 26, 2026
1.0.x-dev Dev 10–11 Feb 7, 2024