Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Rename all files on remote server to *.bak recursively

by kschwab (Vicar)
on Jun 06, 2014 at 04:57 UTC ( [id://1088980]=note: print w/replies, xml ) Need Help??


in reply to Rename all files on remote server to *.bak recursively

You could leverage find and perl on the remote end.
$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);

Replies are listed 'Best First'.
Re^2: Rename all files on remote server to *.bak recursively
by nancylt723 (Initiate) on Jun 06, 2014 at 12:05 UTC
      The cmd is missing the "find /whatever -type f -print|" that should be at the front. Guessing you made some modifications. The perl command is looking for a list of files to be piped to it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1088980]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found