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

Hashes and File searches

by muzakfetch (Scribe)
on Dec 16, 2001 at 12:26 UTC ( [id://132322]=perlquestion: print w/replies, xml ) Need Help??

muzakfetch has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone no code today sorry, however my question centers around a good way to confirm that the files I have downloaded via Net::FTP exist in a predefined hash. So that I can confirm if a file is missing. Does anyone have a good method for this. Thanks Always.. Humbly, muzakfetch

Replies are listed 'Best First'.
Re: Hashes and File searches
by jlongino (Parson) on Dec 16, 2001 at 13:12 UTC
    I don't follow you. Maybe you could explain your Net::FTP process. If you already know what files you need, aren't they already in a hash or array? Aren't you looping through that structure and downloading them one-at-a-time? If so, then store/print the resulting ftp status for each as you go.

    Are you downloading every file in a given subdirectory and then trying to figure out if the ones you want are in the lot you've received? If this is the case, you'll probably want to start with an empty target directory, download the files, loop through the filenames (keys) of your hash and test for their existence.

    --Jim

Re: Hashes and File searches
by CharlesClarkson (Curate) on Dec 16, 2001 at 16:39 UTC
    Well if the files you downloaded are in @ftp_files and if your hash has the filenames as keys and is called %file_names, you could do something like:

    my @exceptions = grep ! exists $file_names{$_}, @ftp_files;




    HTH,
    Charles K. Clarkson

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://132322]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found