Copying blocks from one page to another leaves files in the source folder

Hi,

I’ve copied some blocks from an “old page” to a “new page”.
I’ve come to realise that the files still remain in the old entries folder.
I wanted to delete the old entry, but I guess I would have lost the files?

Is there a way to copy the files into the new entry?
would I really have lost the files when deleting the old entry?

also: $page->files() doesn’t won’t work if the files are not in the folder. it would be very helpful if at least $page->files() would generate results.

-Stefan

Hi,

Am I missing something very obvious?

I’ve tried duplicating the entry with the option “copy files”, but this left the files as they were.

This is really bugging me!

Can anybody enlighten me?

I think I don’t fully your problem or expectations. When you upload files to a page, they live in the page (they are literally stored in the page’s folder). Just because you are copying a block that is referencing the files won’t do anything to the files. The duplicated block will reference the same files as the original block has done.

My expectation for Kirby is that files are always stored in the folder of the related entry.

When I copy blocks from one entry to another, I expect the files associated with those blocks to be copied as well. I strongly prefer keeping all files organized within the entry’s folder.

It feels counterintuitive to have files stored outside of their entry’s folder, doesn’t it?

I’ve encountered this same issue when duplicating entries. At least now, there’s a “copy files” option.

I’m looking for a similar feature: when copying blocks, there should be an option to copy the related files as well (only when copying block from other entries).

I hope you understand the request.
Sorry for my bad english…

The thing is that the entry is the page. Pages are the storage units. Blocks are some (text) content that live like files in their entry’s (the page’s) folder.

Maybe instead of using blocks, have a look at Modules | Kirby CMS Plugins if that fits better to your mental model.

For feature request, please add them to https://feedback.getkirby.com (check if maybe your wish already exists there, then you can add your vote to it too).

I am not sure if you understand me.

let’s say I have this setup:

content
    page-1
        blocks.txt
        file-1.jpg

    page-2
        blocks.txt

If I paste the blocks in page-2 I will not have the file-1.jpg in the folder of page-2.
And I guess, that if I delete page-1, I will loose the reference to this file in page-2.

Maybe something like “Copy all Blocks (w/ files)” would be an option?
IMHO: I think copying blocks within the same page should not duplicate the file, but copying blocks from one page to another page should always copy the files.
There’s not a case I could think of where it would be preferable to not copy the files.

I love to be able to copy/paste blocks from one page to another, but I can see potential problems if the files are not copied as well.

Do you agree?
Do I make sense?

Sorry, I am very new to kirby and this just doesn’t feel right for me. And knowing my clients, I am pretty sure they will mess up if the files are not copied as well.
I am a 10+ years craft cms user who tries to switch to kirby.
Until now I have nothing but love for kirby.
I love the panel. I love yml. I start to love php