Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

SFTP ls command

by talon25 (Initiate)
on Dec 11, 2012 at 19:37 UTC ( #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);

Comment on SFTP ls command
Download Code
Re: SFTP ls command
by blue_cowdawg (Prior) 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 (Canon) 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
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? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2014-08-01 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (257 votes), past polls