Date: Wed, 27 Apr 2022 21:35:45 +0200 (CEST) From: Sysadmin Lists <sysadmin.lists@mailfence.com> To: freebsd-ports@freebsd.org Cc: Andrea Venturoli <ml@netfence.it> Subject: Re: Fill a disk with more recent files Message-ID: <168251995.115947.1651088145958@ichabod.co-bxl> In-Reply-To: <b92d3ed6-0ea4-ff05-b53c-4427c6234eeb@netfence.it> References: <b92d3ed6-0ea4-ff05-b53c-4427c6234eeb@netfence.it>
next in thread | previous in thread | raw e-mail | index | archive | help
With a source disk containing x-amount of space, and a backup disk containing y-amount of space, where x > y, to back up files from x, newest first, until disk y is full, it's as simple as a bash-loop where you specify date ranges on each iteration: for days in {1..30}; do find source/ -type f -mtime -${days} -exec rsync --archive '{}' target/'{}' \; done - or - for days in {0..30}; do find source/ -type f \( -mtime +${days} -mtime -$(($days + 1)) \) -exec tar cf - '{}' + | tar xvf - -C target/ # and use '--strip-components n' to remove leading paths on target done There are advantages and disadvantages to each. > ---------------------------------------- > From: Andrea Venturoli <ml@netfence.it> > Sent: Wed Apr 27 09:47:40 CEST 2022 > To: <freebsd-ports@freebsd.org> > Subject: Fill a disk with more recent files > > > > 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? > > bye & Thanks > av. > -- Sent with https://mailfence.com Secure and private email
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?168251995.115947.1651088145958>