Hello all,
I wanted to write a small script,which i would like to use in the place of rm command to move(rather delete) the files to a remote trash directory using rsync.
Does any one know how to delete directories from the source after the files are rsynced to the remote destination? the --remove-source-files works only for files,and leave many empty directories behind

.
Secondly,is there a better way to do the samething instead of using a foreach statment?? I guess using rsync in a foreach stmtn,will spawn a new rsync connection everytime.
Code:
#!/usr/bin/perl
use strict;
use warnings;
my $user = "ryan";
my $host = "wsx04";
my $pwd ="";
my $Dir="Wsx02";
foreach (@ARGV) {
`rsync --bwlimit=2048 --remove-source-files --delete -e "ssh -c blowfish" -avzpr $_ $user\@$host:/Backup/Trash/$Dir/`;
}
Thanks All.I'm new to perl