#!/usr/bin/perl

use strict;
use warnings;
use File::Copy;
use Data::Dumper;

my $dir_from = shift;
my $dir_to = shift;
my $files_from = shift;
my $files_to = shift;

$files_from =~ s/"//g;
$files_to =~ s/"//g;
$dir_from =~ s/"//g;
$dir_to =~ s/"//g;

my $ans = system("xmessage -center -buttons YES:1,NO:2 -timeout 10 \"CONFIRM?\"");
exit unless $ans == 256;

if ($files_to eq '-') {
  print STDERR "Will delete: $dir_to\n";
  system("rm -rf \"$dir_to\"");
}
else {
  my @files = split /;/, $files_to;

  for (@files) {
    print STDERR "WIll delete - $_\n";
    system("rm -rf \"$_\"");
  }
}

system("echo 1 > /tmp/filetools.refresh");

