App-BorgRestore

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

      1: Mon. 2016-08-15 16:11:29 +0200 backup-20160830-225145
      2: Mon. 2017-02-20 16:01:04 +0100 backup-20170226-145909
      3: Sat. 2017-03-25 14:45:29 +0100 backup-20170325-232957
    Enter ID to restore (Enter to skip): 3
    INFO Restoring home/flo/bin/backup.sh to /home/flo/bin from archive backup-20170325-232957

# DESCRIPTION

borg-restore.pl helps to restore files from borg backups.

It takes one path, looks for its backups, shows a list of distinct versions and
allows to select one to be restored. Versions are based on the modification
time of the file.

It is also possible to specify a time for automatic selection of the backup
that has to be restored. If a time is specified, the script will automatically
select the newest backup that is at least as old as the time value that is
passed and restore it without further user interaction.

**borg-restore.pl --update-cache** has to be executed regularly, ideally after
creating or removing backups.

lib/App/BorgRestore/PathTimeTable/DB.pm  view on Meta::CPAN

	# and no flush is needed. Otherwise we need to flush all parts of the path
	# that are no longer contained in the new path.
	#
	# We start by checking the currently cached path ($old_cache_path) against
	# the new $path. Then we remove one part from the path at a time, until we
	# reach a parent path (directory) of $path.
	$log->tracef("Checking if cache invalidation is required") if TRACE;
	while ((my $slash_index = rindex($old_cache_path, "/")) != -1) {
		$self->{stats}->{cache_invalidation_loop_iterations}++;
		# Directories in the borg output cannot be differentiated by their
		# path, since their path looks just like a file path. I.e. there is no
		# directory separator (/) at the end of a directory path.
		#
		# Since we want to keep any directory in our cache, if it contains
		# $path, we can treat any cached path as a directory path. If the
		# cached path was really a directory, the new $path will also contain a
		# directory separator (/) between the old cached path (the parent
		# directory) and the new path (a subdirectory or a file in the
		# directory). If the cached path was not actually a directory,
		# but a file, the new path cannot match the old one because a file name
		# cannot contain a directory separator.

script/borg-restore.pl  view on Meta::CPAN

   1: Mon. 2016-08-15 16:11:29 +0200 backup-20160830-225145
   2: Mon. 2017-02-20 16:01:04 +0100 backup-20170226-145909
   3: Sat. 2017-03-25 14:45:29 +0100 backup-20170325-232957
 Enter ID to restore (Enter to skip): 3
 INFO Restoring home/flo/bin/backup.sh to /home/flo/bin from archive backup-20170325-232957

=head1 DESCRIPTION

borg-restore.pl helps to restore files from borg backups.

It takes one path, looks for its backups, shows a list of distinct versions and
allows to select one to be restored. Versions are based on the modification
time of the file.

It is also possible to specify a time for automatic selection of the backup
that has to be restored. If a time is specified, the script will automatically
select the newest backup that is at least as old as the time value that is
passed and restore it without further user interaction.

B<borg-restore.pl --update-cache> has to be executed regularly, ideally after
creating or removing backups.



( run in 0.598 second using v1.01-cache-2.11-cpan-64827b87656 )