$remotehost="somehost.tld"; $remotedir="/some/dir/"; $cmd="/usr/bin/ssh $remotehost find $remotedir -type f -print". '| perl -ne \'chomp;$n=$_.q^.bak^;rename($_,$n)\''; print "cmd is [$cmd]\n"; #uncomment after testing #system($cmd);