Re: Fill a disk with more recent files

From: Tomek CEDRO <>
Date: Wed, 27 Apr 2022 09:50:39 UTC
On Wed, Apr 27, 2022 at 10:09 AM Andrea Venturoli <> wrote:
> On 4/27/22 09:51, Tomek CEDRO wrote:
> > On Wed, Apr 27, 2022 at 9:48 AM Andrea Venturoli <> wrote:
> >> Hello.
> >> Suppose I have a large storage of files and a smaller disk (backup).
> >> I need to copy as much as I can from source to target and I want the
> >> most recent files.
> >> Before I start scripting and reinvent the wheel, is there some tool already?
> > rsync :-)
> Thanks for your answer.
> Rsync is what I've been using up to now.
> However I fail to find an option to tell it to sort the file from most
> recent to older. What is it?

rsync uses its own order as stated in man page:

       Rsync always sorts the specified filenames into its internal transfer
       list.  This handles the merging together of the contents of identically
       named directories, makes it easy to remove duplicate filenames, and may
       confuse someone when the files are transferred in a different order
       than what was given on the command-line.

       If you need a particular file to be transferred prior to another,
       either separate the files into different rsync calls, or consider using
       --delay-updates (which doesn't affect the sorted transfer order, but
       does make the final file-updating phase happen much more rapidly).

If you want to enforce particular sort order you will have to call
rsync from another tool. Probably ls / find, sort, then rsync, maybe a
dedicated Python script.

That also depends on how do you want to treat existing backup files.
Do you want to delete them all completely on backup, or remove oldest
files in order to make a room for the new files?

Have you considered ZFS (full/incremental) snapshots and partitioning
your pool into areas based on backup priority? I use this method.

With ZFS you can frequently create incremental snapshots for important
locations and stream them into a backup file. Having smaller locations
to backup also makes initial full snapshot smaller and that allows
full workspace recovery. ZFS also allows quick access to a single
files from selected snapshots by entering
pool/this/was/my/work/folder/top/.zfs when its on the pool so you do
not have to even copy/extract anything.

Sorry I do not know any better out-of-the box solution matching your needs.