# Archiving (zipping) page content folder for downloading

**URL:** <https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690>\
**Category:** Questions\
**Tags:** v3\
**Created:** [May 30, 2023, 11:24pm UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690 "2023-05-30T23:24:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bristolscript](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bristolscript/32/4740_2.png) [@Bristolscript](https://forum.getkirby.com/u/Bristolscript)\
**Post date:** [May 30, 2023, 11:24pm UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/1 "2023-05-30T23:24:18Z")

</div>

Trying to figure out how to archive page data (txt and images).  
Thinking of using $page-\>contentFiles() and then create zip archive with PHP methods. But maybe there is some other way (some other $page function) how to achieve this?

This is necessary for downloading page data as backup / update to local machine.

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [May 31, 2023, 5:25am UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/2 "2023-05-31T05:25:27Z")

</div>

Do you have access to your site via a shell or ftp?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [May 31, 2023, 6:25am UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/3 "2023-05-31T06:25:04Z")

</div>

With Janitor plugin, you can create a button for creating a zip from the Panel (its a built-in job)

> **[GitHub - bnomei/kirby3-janitor: Kirby 3 Plugin for running commands like...](https://github.com/bnomei/kirby3-janitor)**
>
> Kirby 3 Plugin for running commands like cleaning the cache from within the Panel, PHP code, CLI or a cronjob - GitHub - bnomei/kirby3-janitor: Kirby 3 Plugin for running commands like cleaning the...

And in particular:

> **[GitHub - bnomei/kirby3-janitor: Kirby 3 Plugin for running commands like...](https://github.com/bnomei/kirby3-janitor#built-in-commands-and-examples)**
>
> Kirby 3 Plugin for running commands like cleaning the cache from within the Panel, PHP code, CLI or a cronjob - GitHub - bnomei/kirby3-janitor: Kirby 3 Plugin for running commands like cleaning the...

There’s also: [GitHub - sylvainjule/kirby-backups: Manage backups from the Kirby panel](https://github.com/sylvainjule/kirby-backups), but I don’t know if it’s still working.

What you could also do to automate this, is create a cron job that runs at given intervals. Kirby doesn’t have methods for zipping, but you can use PHP’s ZipArchive class: [PHP: ZipArchive - Manual](https://www.php.net/manual/de/class.ziparchive.php)

---

<div class="post-metadata">

**Author:** ![jimbobrjames](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jimbobrjames/32/5802_2.png) [@jimbobrjames](https://forum.getkirby.com/u/jimbobrjames)\
**Post date:** [May 31, 2023, 6:19pm UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/4 "2023-05-31T18:19:51Z")

</div>

I do it with the following CLI command to create zipped up backups with a bonus time stamp added on the file name so you know when the back up was made. Tweak the inclusions / stuff to skip obviously. I usually tie into an NPM script but it should also work from the cli if you have SSH access.

```sh
zip -r9 ./package/yourproject-$(date +'%d-%m-%Y-%H-%M-%S').zip public src package.json webpack.mix.js -x '*/*.DS_Store' '*/*.lock' '*/media/*' '*/site/accounts/*' '*/site/cache/*' '*/site/sessions/*'

```

---

<div class="post-metadata">

**Author:** ![Bristolscript](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bristolscript/32/4740_2.png) [@Bristolscript](https://forum.getkirby.com/u/Bristolscript)\
**Post date:** [June 1, 2023, 8:33am UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/5 "2023-06-01T08:33:30Z")

</div>

I have access to site via ftp (full access), but probably I should create another account which would have access only to /content folder and only for downloading.

Currently Im writing Node JS script which (from local machine) would make request to site with Kirby and custom API would create that zip and return link to it. Which then Node JS would download and extract on local machine. Hmm, maybe connecting and downloading from ftp would be more stright forward without additional Kirby API customisation…

---

<div class="post-metadata">

**Author:** ![Adspectus](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/adspectus/32/189_2.png) [@Adspectus](https://forum.getkirby.com/u/Adspectus)\
**Post date:** [June 1, 2023, 10:51am UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/6 "2023-06-01T10:51:00Z")

</div>

> [@Bristolscript](#):
>
> maybe connecting and downloading from ftp would be more stright forward

Absolutely. Linux, MacOS and even Windows are coming with build-in ftp clients which you can use for that simple task, even with automation in the background. You can also use `curl` and `wget` for that.

> [@Bristolscript](#):
>
> probably I should create another account which would have access only to /content folder and only for downloading

That would be a good idea too, if you are bound to a solution which uses the ftp protocol from another machine. And make sure that you ftp connection is secure.

---

<div class="post-metadata">

**Author:** ![lukasbestle](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/lukasbestle/32/11437_2.png) [@lukasbestle](https://forum.getkirby.com/u/lukasbestle)\
**Post date:** [June 11, 2023, 10:23am UTC](https://forum.getkirby.com/t/archiving-zipping-page-content-folder-for-downloading/28690/7 "2023-06-11T10:23:19Z")

</div>

My Versions plugin also supports exporting the `content` folder as ZIP file from the Panel, with the added benefit that the content is always consistent (based on the specific version, so changes during the export process don’t affect the result). However it always exports the entire `content` folder, not just a particular page.

> **[GitHub - lukasbestle/kirby-versions: Keep track of content changes and switch...](https://github.com/lukasbestle/kirby-versions)**
>
> Keep track of content changes and switch between different versions from the Kirby 3 Panel - GitHub - lukasbestle/kirby-versions: Keep track of content changes and switch between different versions...
