#!/usr/bin/perl

use Net::FTP::Recursive;

####################################################################
# will assume just a few args, as well as validity.
####################################################################

usage() unless @ARGV >= 4;

$host = shift;
$username = shift;
$passwd = shift;
$remote_path = shift; #where to delete

$ftp = Net::FTP::Recursive->new($host, Debug => 1);

$ftp->login($username, $passwd) or die "Could not log in!";
$ftp->binary();

$ftp->cwd($remote_path);

$ftp->rdelete( map{($_, 1)} @ARGV);

$ftp->quit;

sub usage {
  my($name) = $0;
  $name =~ s#.*/##;

  print STDERR "Usage: $name <host> <username> <passwd> <remote_path> [options]\n";
  exit;
}