Is there a way to publish multiple files at once?

Silverstripe Version:4.11

Is there a way to publish multiple files at once?

I want to sort the folder structure for a website differently as it got a bit cluttered over time.
When you move a folder all files get the status ‘modified’ and are not really moved until they are published again. I was wondering if there is a way to select all files at once and publish them all at the same time or is there a config setting to achieve the move without the need for re-publishing?**

Thanks a lot.

You can select multiple files with the checkboxes in the ‘Files’ area, then from the dots menu at the bottom, you should be able to select ‘Publish’ and it will publish all the selected files / folders.

If the files are attached to pages, and you have the $owns declaration in place, then the files will be republished when the page is republished… you can republish multiple pages with the batch actions in the Pages area of the CMS,

There is a route for publishing all the pages at httsp://yoursite/admin/pages/publishall

But, it’s being deprecated because it can cause a massive performance hit on a big site, and doesn’t always publish all the files… so it shouldn’t be relied on!

Hi DorsetDigital,

Thank you very much for your reply.

I knew the one with ticking all the checkboxes, but this was exactly my problem that with folders having many files it is quite cumbersome to tick every file. I was hoping for a setting that would add an ‘select all’ way of doing it. That might be a good feature for the future.

I am so glad to hear that the re-publishing of the page, where I set the ‘own’ is doing the trick.

Thanks a lot for telling me this trick.
You saved my day :slight_smile:

Recursively publishing all the files is potentially a very intensive operation, and I’d say it’s an unusual operation for every-day CMS use.

The other way to approach it would be to write a build task which could be run by an admin user which just gets all the files and publishes them one-by-one. It’s obviously a bit of a sledgehammer approach though!

True, but it’s an interesting idea.
Thanks for your help :grinning:

I use a little bit of javascript to do a ‘select all’ when I’m faced with this. Pop open your console when viewing your files admin screen, then enter this:

jQuery(‘.gallery__files .gallery-item__checkbox-label’).trigger(‘click’);

voila - all files in the current view will be selected from where you can select the publish option.

Hi noizyboy,

What a great idea.

I am so glad I asked here.

Thank you very much.

You don’t need to select each checkbox individually (if you’re a mouse user).

You can click/drag and select all the files at once to publish/unpublish:

kaftka - thanks for this as well. Been using Silverstripe for years now and never knew that was possible. You live and learn!

Hi kaftka,

Another great useful solution.
Thanks a lot :grinning:.

Hi @Kimk , you can also use shift + left click to check all the files to publish/unpublish.

Select 1st file, scroll down to last file and use shift + left click, it will select all the files. If you click outside the file section, it will remove all the selected files.