On 30 Jun 2002 22:04:42 PDT, Nicholas G. Thornton wrote:

>I have a program which is currently set up to generate files from a database and
>upload them to a website via FTP (using the same local temp file for each page
>before uploading it.)
>
>I want to alter it now to make all those files locally, putting them in the
>correct folders et al. Now normal creating of files is easy, the question I have
>is how to go about changing the current working directory (or whatever) to get
>them into the correct folders.

You must use FTP commands. There's a equivalent Perl method for all of
them, so check them out: mkdir() oh, and look at that, it can create a
deep path nesting level at once!) , cd(), cdup(), pwd() to find out
where you are. The only one I'm now still missing, is chmod(). You
likely will have to do that through site(). The command should look
like:

        SITE chmod 644 filename

In Perl (untested):

        $ftp->site('chmod 644 filename');


Also check out Lincoln Stein's book "Network Programming with Perl", for
which the chapter on Net::FTP is  online:

        <http://modperl.com:9000/perl_networking/sample/ch6.html>


An alternative approach that I would reconsider, is to create a tar file
(or even a tar.gz file) locally, upload that one, and then, with remote
shell access (Net::Telnet -- same chapter), let tar on the server side
unpack the archive and take care of the whole filetree thing.

-- 
        Bart.

Reply via email to