6

I've got a bunch of files in sites/default/files that I'd like to move to a sites/default/files/subfolder to avoid a big mess.

The fields uploading files have been configured to put them in the right folders in the future. What I'm looking for is a solution to organising files already uploaded.

Any suggestions?

0

The module File (Field) Paths allows this per file field.

For Drupal 8:

  1. Manage fields: Edit the File field
  2. Check the option "Enable File (Field) Paths?"
  3. Expand "File (Field) Path settings"
  4. Check the option "Retroactive update"
  5. Save settings

Now all of this field’s files will be moved/renamed (you should see a progress bar). This is a one-time action, so if you need to move the files again, you have to repeat these steps.

If you always want to move the files when the path changes, you can check the "Active updating" option.

4

It sounds like you're looking for File Maintenance.

Ever wanted to move files from your sites/default/files directory (or whatever you have configured) to a (new) subdirectory? Never did it because you knew it's a damn mess since you need do move the physical file, adjust the database files table and look through all the node_revisions table and other content to adjust the link to the file so as not to break your site?

That should cover any files that are managed under the files table (pretty much any field you should have). If you have any other files under sites/default/files that aren't managed by Drupal, then custom redirect htaccess rules should cover those files.

  • wow, how could I not google that:)?! Thanks a bunch! – Kristoffer Rom Sep 13 '15 at 17:33
  • Just note that File Maintenance module for Drupal 7 is still work in progress, and no file operations can be performed yet, but the file browser UI is functional and informative. So its usefulness is partial right now: mostly to find out which files are in the filesystem and not in database, and vice versa. – Interdruper Sep 17 '15 at 8:25
0
  1. In files table change the uri column value from sites/default/files to sites/default/files subfolder.
  2. Now move all the files from sites/default/files to sites/default/files subfolder.
0

I found the best solution to be the Organize Files module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.