Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Location
    india
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation error simulating an ftp client

    i am using array to store a command given at run time by user... and execute it.....but after a connection is made to any ftp sites only 'ls' or 'dir' commands work....and if i wish to change directory or get any file or put file.example
    get("123.mp3")
    put("abc.txt")
    cd user
    etc or any commands that has space in between
    then it gives error.wat i cn do to get or put files ...



    #!/usr/bin/perl

    use Net::FTP;

    print("\nHost\/IP: ");
    $host = <STDIN>;
    chomp ($host);

    print("\nUsername: ");
    $username = <STDIN>;
    chomp ($username);
    print "Password: ";
    chop ($password = <STDIN>);
    `stty echo`;
    print "\n";

    print("Connecting to $host...\n");
    my $ftp = Net::FTP->new($host) or die "Couldn't connect to $host\n";
    print("Connected!\n");
    print("\nFTP>");

    $ftp->login($username, $password)
    or die "Could not log in .\n";

    rep:

    $command = <STDIN>;

    chomp ($command);

    unless ("$command" eq "bye") {


    @listing = $ftp->$command;

    for($i=0;$i<@listing;$i++) { print "$listing[$i]\n"; }

    print("FTP>");

    goto rep;

    }
    Attached Files Attached Files


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •