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:
- Searches the
file_managedtable for any files that reside in the root (or the specified subdirectory). - 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/. - Updates the
file_managedtable with the new file location. - Searches the
field_bodyfield and any text blocks for any reference to the filename and updates the path. - 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:
--feedbackoption 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.
Project information
- Project categories: Media
- Created by chris dart on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.



