Duplicate page to another content folder

I’m trying to find a way to move pages to a different part of my website, i.e. a different content folder.

The idea is essentially to move a page + all its files into an “archive” page/content folder once the event date is in the past via a cronjob.

I’ve tried using $page->duplicate() but it creates a child, which is not exactly what I want to do.

I’ve read that Kirby doesn’t allow directly moving pages within the content folder so I tried to play around with copy or duplicate with the intention of deleting the original page once everything has been moved.

Nevermind, I found the solution.

using Dir::move() I can get it done.