Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

SFTP ls command

by talon25 (Initiate)
on Dec 11, 2012 at 19:37 UTC ( [id://1008385]=perlquestion: print w/replies, xml ) Need Help??

talon25 has asked for the wisdom of the Perl Monks concerning the following question:

I am using the SFTP::Foreign::Compat module. Recently the other side of the connection migrated to a new server. My process is using the ls command to store the available files. When I log into the server directly, I can see the files, but my script is not getting any information, but seems to be connected just fine. @dir_list is coming back as undef. This was working prior to the other side migrating. Any ideas what would cause the command to stop getting data?

my $remote_dir = "outgoing/"; @dir_list = $bkcy_sftp_h->ls($remote_dir);

Replies are listed 'Best First'.
Re: SFTP ls command
by blue_cowdawg (Monsignor) on Dec 11, 2012 at 21:15 UTC
        Any ideas what would cause the command to stop getting data

    You haven't given us much to work with here. Thing's I'd be checking:

    1. What changes were made during the migration?
    2. Are the directories intact?
    3. Use a manual session and try to do at least a subset of what your script is attempting to do
    As a programmer my hackles go up when someone upgrades a server I'm depending on and my scripts start breaking. Usually some change that happened during the upgrade is the culprit. On rare occasions I find my code not compatible with the new environment but I keeps my feathers numbered for just such an emergency.


    Peter L. Berghold -- Unix Professional
    Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
Re: SFTP ls command
by roboticus (Chancellor) on Dec 11, 2012 at 22:46 UTC

    Gah! Missed the 'S'. None of this applies, as it was for Net::FTP.

    talon25:

    I had the same problem a few (8?) years back. The problem I encountered was that the 'ls' format for FTP isn't standardized. Many FTP programs will use something very unix-like, but you'll sometimes find (IBM MVS, etc.) systems where the format is different enough that the standard parser wasn't up to the task of splitting out the filenames. I'm digging through my archives to see if I can find the code, and if I do, I'll update this node. But if I recall correctly, what I wound up doing was calling the "long form" version that just returned the text of the directory listing, and then wrote my own parser to split out the filenames.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

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

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

    No recent polls found