# Media File Privacy Drupal 10/11 module providing two Media actions: 1. **Move unpublished media files to private storage** - Runs only on unpublished Media entities. - Moves a source file only when its URI begins with `public://`. - Example: `public://2026-08/example.jpg` -> `private://2026-08/example.jpg`. 2. **Move published media files to public storage** - Runs only on published Media entities. - Moves a source file only when its URI begins with `private://`. - Example: `private://2026-08/example.jpg` -> `public://2026-08/example.jpg`. ## Installation Place the module at: web/modules/custom/media_file_privacy Enable it: drush en media_file_privacy -y drush cr The actions should then be available to Media Views Bulk Operations / the standard Views bulk form, depending on the View configuration. ## Collision handling If a file already exists at the destination URI, the action logs an error and does not overwrite or rename either file. Errors are written to the `media_file_privacy` log channel. ## Private file system Drupal must have a working private file path configured, for example in settings.php: $settings['file_private_path'] = '/var/www/site-files/private'; The directory must be writable by the web/PHP user.