Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:52:26+00:00 2026-06-03T15:52:26+00:00

I wrote a script to download some data from FTP by a subroutine. I

  • 0

I wrote a script to download some data from FTP by a subroutine. I tell the program to download the data that belong to my stations which are listed in @station_list array with capital letters. The corresponding data are located at separate pages with the name of the each station in small letters, e.g. ftp://$ftp_srv/$ftp_dir/aaaa is the page for aaaa station and ftp://$ftp_srv/$ftp_dir/bbbb is the page for bbbb station. So, I make a loop for downloading and converting the capital letters to small ones. But it just work for the first station. I don’t know what shall I do to fix it. Thank you for any help.
The following code is the mentioned loop:

foreach $station (@station_list) {

    $litte_station = "\L$station\E";

    unless ($ftp->cwd($litte_station)) {
        $ftp->quit;
        print2("Can't cd to $station  $!\n");
        return (0);
    }

    $filename = "\L${station}\E${doy}\L$sessionchar\E.${yy}o.gz";
    print2 ("Get file: ${ftp_srv}\\${ftp_dir}\\${yyyy}\\${doy}\\${filename} ...");

    unless ($ftp->get($filename, $ftp_savepath.$filename)) {
        print2(" NOT AVAILABLE\n");
    } else {
        print2 (" Successful \n");   
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:52:27+00:00Added an answer on June 3, 2026 at 3:52 pm

    In response to your comment on my first answer, I now better understand what you were asking. At the end of your foreach loop, call $ftp->cdup:

    foreach my $station (@station_list) {
        $ftp->cwd(lc $station);
        # ...
        $ftp->cdup;
    }
    

    That will return you to the parent directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a script that will download files from an FTP server.
I wrote some code to download some files from URLs, which I put in
I wrote a python script to process some data from CSV files. The script
So I've wrote a small script to download pictures from a website. It goes
So I wrote this short script (correct word?) to download the comic images from
I write curl php script which work is download csv file from one website
I wrote a python script which I am using to download a large number
I wrote a script that downloads files from an Http server, but the results
I'm about to be forced to write a script to download some number of
I am required to write a script that would download a file (based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.