my $rsync_base_cmd = "rsync -avm -L --exclude='S/' --include='*/' --include='*.cpp' " . "--include='*.hpp' --exclude='*'"; my $command = "$rsync_base_cmd ${login}:${remoteDirectory} $localDirectory"; open my $fh, '-|', $command or confess("_copy_component Cannot perform rsync : $!"); my $output; while(<$fh>) { $output .= $_; } close $fh or confess("rsync problem: $!");