This project is not covered by Drupal’s security advisory policy.

Overview

If your site has a huge number of files in the root public:// directory, this module can help organize them. This is especially useful if you have switched to s3 and use a file WYSIWYG file management tool like IMCE.

The module has no graphical user interface. It's just a drush command drush file-organizer with some additional functions, including identifying a subdirectory in public://, getting feedback on what is being moved. Currently it only works on the field_body field.

This has not been tested with the Media module.

Here's what it does:

  1. Searches the file_managed table for any files that reside in the root (or the specified subdirectory).
  2. Loops through the list of files, and using the timestamp of each file, moves it to a subdirectory based on the year and month. For example, if a file timestamp is from January of 2018, then the file will be moved to public://2018/09/.
  3. Updates the file_managed table with the new file location.
  4. Searches the field_body field and any text blocks for any reference to the filename and updates the path.
  5. At the end of the process, shows a list of errors (if any).

Requirements

You will need to install drush to make use of this module.

WARNING: This module is for advanced developers (or those who like taking risks).

  • There is no rollback option. Be sure to back up your database and files directory before running this.
  • Test on a development environment before running live.

Installation

  • Run command: drush file-organizer
  • or enable in the “Extend” interface

Options

Options for the command:

  • --feedback option will report each file that will be moved and then confirm that it was moved.
  • --dir=[some-directory] will process files in a given directory. For example, if you have a subdirectory called "jumbotron_images," then you'd write --dir=jumbotron_images.
Supporting organizations: 
Funded the development

Project information

  • Project categories: Media
  • Created by chris dart on , updated
  • shield alertThis project is not covered by the security advisory policy.
    Use at your own risk! It may have publicly disclosed vulnerabilities.

Releases