How to delete some file after a build

Looking for a way to categorise images assets after the blog permalink in V4.

I’ve noticed that adding the locale extension to the image file name, at least during a build the image is copied on the right locale destination folder.
The same doesn’t happen for folders, thus resulting in all of them copied across the different locale configurations.

I believe that using an after build block should do the trick, but I can’t find any documentation on what can I so with that method.

after_build do |builder|
...
end 

Any idea?

You can use Thor::Actions like so:

after_build do |builder|
  builder.thor.remove_file 'path/to/file'
end

See here for other available methods.

Thanks, where can I get more documentation about that?

The doc on custom extensions seems to be the only official source of info around this. It’s at the bottom of this fairly short page.

Cheers. I think I can work around with a rename using the File. and its method.