From f13cd5fd1d45a12136ef25710f0a789f1bab2104 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 27 Nov 2010 17:04:55 +0100 Subject: restore.pl: fix restoration of /home/flo/bin Signed-off-by: Florian Pritz --- restore.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'restore.pl') diff --git a/restore.pl b/restore.pl index 63c89ff..3d00026 100755 --- a/restore.pl +++ b/restore.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl #---------------------------------------------------- -# Version: 0.1.1 +# Version: 0.1.2 # Author: Florian "Bluewind" Pritz # # Licensed under WTFPL v2 @@ -11,7 +11,7 @@ use warnings; use strict; use File::Basename; -use Cwd; +use Cwd qw(abs_path cwd); use DateTime; use File::Copy::Recursive qw(rcopy); use File::Find; @@ -27,9 +27,12 @@ if (@ARGV == 0) { exit 0; } +my $startdir = cwd(); + for my $filename (@ARGV) { + chdir $startdir; my @filelist; - my $file = Cwd::abs_path($filename); + my $file = abs_path($filename); my $lastmodtime = 0; for my $key (keys %mapping) { @@ -69,6 +72,7 @@ for my $filename (@ARGV) { print "\e[0;34mEnter ID to restore (Enter to skip): \e[0m"; my $id = ; chomp $id; + chdir "/"; next unless (exists ($filelist[$id])); remove_tree $file if -d $file; # need mtime preservation -- cgit v1.2.3-24-g4f1b