Michael,
Escape the dot: "\." That should do't.
Joseph
Michael Kramer wrote:
> I've been having some problems with this little code two major issues.
> What I'm tring to do is get Photos off an FTP site:
> I have a text file with about 4000 lines and on each line is an eight digit
> number "30635325". I take all of the is an put it into an array. Then I
> have to change the info to 30635325_0.jpg because on the FTP site that's how
> each one of the Photos are saved. I'm getting weird output here the "." is
> not working example of the output "_0.jp 78". Next assuming it works. I
> connect to the FTP site and get a list of what they have. The fun thing is
> that the FTP site has most of the photos I need but they are separated in to
> different folders, so the file I need is "30635325_0.jpg" is located in
> first folder "30" second folder "635" then the file is "325_0.jpg". I have
> written the code to do this but it take a long time and I wanted to know if
> this is the best way to do it. If any one could please help me it would be
> greatly appreciated.
>
> Thanks
>
> #!/usr/local/bin/perl -w
> use strict;
>
> print "Step 1: Find the $file in $dir.\n";
> chdir($dir) or die "Can't open $dir: $!";
>
> print "Step 2: Open the $file.\n";
> open(FILE, $file) or die "Can't open $file: $!";
> @word = <FILE>;
> chomp @word;
> close(FILE);
>
> print "Step 3: Clean up our listings.\n";
> #I need to fix the listings from the text file to what they are on the FTP
> sit
> @correctedwords = ();
> foreach $item (@word) {
> if (substr($item,length($item) - 6, length($item)) ne
>"_0.jpg"){
> $looking_for_listings{$item . "_0.jpg"} = 1;
> } else {
> $looking_for_listings{$item} = 1;
> }
> }
> ################################
> #once I do this I have been getting some funkey out put. "_0.jp 67"
> ################################
>
> #I need to see if they exist on the ftp site.
> print "Step 4: Start FTP.\n";
> use Net::FTP;
> #... connect to the FTP site.
>
> $ftp->cwd("$pin_folder")
> or $ftp->cwd("$pin_folder")
> or die "Couldn't change to dir $pin_folder. \n$!\n";
>
> print "Step 5: Get the list they have.\n";
> @first_folder = $ftp->ls()
> or die "Couldn't get a list of files. $!\n";
>
> foreach $myfolder (@first_folder) {
> $ftp->cwd("$myfolder")
> or die "Did not work $myfolder\n";
> @second_folder = $ftp->ls()
> or die "can't get list in $second_folder. \n";
> foreach $folder2 (@second_folder) {
> $ftp->cwd("$folder2")
> or die "did not work $folder2\n";
> @files = $ftp->ls()
> or die "can't get the list in $folder2";
> $ftp->cwd("../")
> or die "can't get the list in ../";
> foreach $file (@files) {
> if ($looking_for_listings{$myfolder .
>$folder2 . $file}) {
> $seen{$myfolder . $folder2 . $file}
>= 1;
> }
> }
> }
> $ftp->cwd("../")
> or die "can't get the list in ../";
> }
>
> print "Step 6: print the list they have and we want.\n";
> #I should get about 300 listings but I get nothing!!!!
> for $a ( keys %seen) {
> print "$a=$seen{$a}\n";
> }
>
> $ftp->quit();
>
> Michael Kramer
> [EMAIL PROTECTED]
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]