Archive Recent creates a compressed archive of recently changed files.
Using archiverecent
To get started with Miln Archive Recent, download and expand the executable file onto your computer.
Archive Recent is a single executable file. It does not need to be installed, can be run from any directory, and can be removed by deleting the file.
Let’s walk through an example use of archiverecent
. Consider this command line call:
./archiverecent -from Photos -since 2025-01-31 -output latest-photos.tgz
The flags for this call to archiverecent
are:
-from Photos
- The directory to read files from.
Photos
is the relative path to a directory. -since 2025-01-31
- The date from which to include modified files. Every file within the
Photos
directory, that has been modified on or after 31st January 2025, will be included in the archive. -output latest-photos.tgz
- The filename of the archive to create.
What Happens
So what happens when this command is issued?
archiverecent
does the following:
- An archive is created and prepared for writing to
- The contents of
Photos
are read, looking at each file’s modification date…- …if the file’s modification date is on or after
2025-01-31
, the file is added to the archive
- …if the file’s modification date is on or after
The created file is a gzipped tar archive (.tar.gz
/.tgz
). This is a widely supported file format that will be recognised and accessible for decades to come. This makes it ideal for long term storage.
If no files have been modified, the final archive will still be created but will be empty.
Archive Recent will overwrite any existing archive file with the same name.
Why I wrote this tool
I wrote Archive Recent to help me prepare incremental archives of my photos for backing-up.
Each month I like to back-up my new and changed photos to a long term store on a remote server. I used to prepare an archive manually by exporting photos from an application and then running a series of command line tools to finalise the archive.
The manual process was fine for many years. Sometimes it felt a little time consuming but never a real burden. Then the photos application I used changed and obscured the file layout I had been relying on for easily extracting recently changed files.
That application’s change was the first in a series of changes that pushed me away. I exported all my photos and metadata to a network drive.
I am now manually managing my photos as “just a bunch of images” on disk. Thankfully a welcome number of photo applications work well with this approach. As a bonus my reliance on a single photo application is behind me.
Without the ability to ask an authoritative photo application for recently changed photos, incremental back-ups remained a challenge.
I searched for various approaches to solving this problem. Many good solutions exist in the form of custom shell scripts using find
and rsync
. This should have been good enough but I worried my script would be fragile.
So rather than write my own shell script, I wrote archiverecent
. The problem felt common enough that it deserved a more general tool.
This tool solves my incremental back-up problem. I expect it will be useful for you too.
Examples
Below are examples of alternative uses of Archive Recent.
Last 24 hours
Archive documents that have changed in the last 24 hours:
./archiverecent -since 24h -from ~/Documents
Multiple Sources
Archive changed files in the last 30 days, from multiple directories, into one archive:
./archiverecent -since 720h -from Photos:Documents/projects:Documents/legal
Flags
archiverecent
accepts the following command line flags:
Usage of ./archiverecent:
-config string
File path to configuration.
-dry-run
list files that would be archived but do not create the archive
-exclude string
exclude directories and files with these names (default "@eaDir")
-f string
paths to archive files from (shorthand)
-from string
paths to archive files from
-h Show this help message and exit. (shorthand)
-help
Show this help message and exit.
-l string
Directory path to licence certificate files (PEM encoded) (shorthand) (default "~/.miln/")
-legal
Show legal notices and exit.
-licence string
Directory path to licence certificate files (PEM encoded) (default "~/.miln/")
-o string
path to create archive at (shorthand) (default "archive.tgz")
-output string
path to create archive at (default "archive.tgz")
-s string
date or duration since file modification to archive (shorthand)
-show-licence
Show licence details and exit.
-since string
date or duration since file modification to archive
-v Show version details and exit. (shorthand)
-version
Show version details and exit.