in reply to Re: FTP Module Suggestions
in thread FTP Question

In addition, you may also wish to look at the samples in the FTP Stuff section of the Code Catacombs.

You did not say why a standard FTP program was failing. Is it timing out? Failing because of the size of the directory? Or was it failing because you need something with a little more power to do things like lowercase or uppercase all filenames, remove spaces, and/or split the files into directories by one or more initial letters or something?

Hopefully the excellent references suggested thus far by respondents to your post will be of help. Failing that, posting additional information may allow someone to offer you additional ideas or snippets that may be useful. In either case, I hope you find what you seek, and, perhaps, will even take time to post the solution you find, to aid those who may come after with similar needs.

Update: You may also wish to check the Snippets Section for postings. grinder has an interface which may make that easier to do for what you seek.

Update: Found a basic snippet of code I had that might help you get started.

# # Assumes %filelist and %connectinfo defined and # filled earlier # my $ftp = Net::FTP->new($connectinfo{'host'}; $ftp->login($connectinfo{'user'}, $connectinfo{'pass'}); my $current_target_directory = ""; foreach my $filename (sort(keys(%filelist))) { if ($current_target_directory ne $filelist{$filename}{'target'}) { $current_target_directory = $filelist{$filename}{'target'}; $ftp->cwd($current_target_directory); } $ftp->put($filename); print($filename, "\n"); } $ftp->quit;

Update: Modified title.

Replies are listed 'Best First'.
Re: Re: Re: FTP Question
by LostS (Friar) on Dec 17, 2002 at 15:41 UTC
    OK for why it is failing... It isn't failing... It is just not uploading allt he stupid images. What it is is a CD with a directory called Images. In this directory is approx 42,000 badge images. No I go to command prompt ftp to the server and say mput e:\images\*.jpg and it begins uploading and finishes without complaining. But when I run my script to check to see if the user has an image I notice some images are not uploaded. Like they are left out and ignored. I have tried using the command line from Windows 2000 and tried using CuteFTP (It wont even start with that program) and tried WS_FTP and same thing. It uploads but doesn't upload everything. I think it is due to the number of files. I don't think one should put over 10,000 files in a single directory. Just me I dunno... That is why I am needing to do this. But thank you all for this help. It has helped get me in the direction I need to go to solve this issue and move on to the next. Thank you all...

    -----------------------
    Billy S.
    Slinar Hardtail - Hand of Dane
    Datal Ephialtes - Guildless
    RallosZek.Net Admin/WebMaster

    perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'
      I would make two stabs at this, First 40k Files in one dir on a cd is kinda bad, it will take forever to stat the dir. You may try soting your files into a tree (this kinda reminds me of the old news servers that tried to store all of the groups in one dir, they all moved to a fs tree or db of some sort pretty quickly) For example if your filenames look like this:
      B12C113.jpg D92C113.jpg G12C934.jpg B12C117.jpg

      You may be able to sort them into a dir tree like this:
      \B\1\2C113.jpg \B\1\2C117.jpg \D\9\2C113.jpg \G\1\2C934.jpg

      It really depends what your file name convention is. You really just want to split the file names up in a way where you get a clean spread across a lot of dirs where you do not have to stat 40k files when you stat the dir. the task of creating this layout should be very simple with substr. Let me know if you need more info I may have some code around that shows an example of how to do this.

      Then deal with the transfer -- you may notice that it is simplified.

      -Waswas