Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Escaping special characters in filename for Net::SCP

by blazar (Canon)
on Mar 29, 2005 at 09:20 UTC ( #443075=note: print w/ replies, xml ) Need Help??


in reply to Re: Escaping special characters in filename for Net::SCP
in thread Escaping special characters in filename for Net::SCP

$scp->put(quotemeta) yields:

Couldn't transfer `/real/file->name': \/real\/file\-\>name: No such file or directory
$scp->put(qq|'$_'|) yields:
Couldn't transfer `/real/file->name': bash: -c: line 1: unexpected EOF while looking for matching `''
bash: -c: line 2: syntax error: unexpected end of file
lost connection
D'Oh!


Comment on Re^2: Escaping special characters in filename for Net::SCP
Select or Download Code
Replies are listed 'Best First'.
Re^3: Escaping special characters in filename for Net::SCP
by samizdat (Vicar) on Mar 29, 2005 at 15:45 UTC
    What a gross mess, blazar. Anything other than something like the following is not worth your time:
    use File::Copy; $basedir='/path/to/files'; $foo = $_; $foo =~ s#/#slash#g; $foo =~ s#->#arrow#g; $fubar = "$basedir/$_"; copy($fubar, "$basedir/$foo"); $scp->put("$basedir/$foo"); system('rm', "$basedir/$foo") && die "Can't remove $foo:$!\n";
    with appropriate my's and stricts as appropriate.
      I must say that in the meantime I've happily switched to Net::SFTP, so no more problems on the practical side of things. Still slightly curious if it would have been possible to do it with Net::SCP and if so, how. Net::SFTP seems a superior solution in any case...
        sftp is better than scp, so I'm not surprised that Net::SFTP is better. I don't know if scp is being kept up with all of the latest OpenSSH ports, either. Don't use it myself. :)

        In any event, glad you're past it! :D

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-07-07 23:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls