Gossamer Forum
Home : General : Perl Programming :

How to do this.....

Quote Reply
How to do this.....
Hi. I am the webmaster at http://ace.upyour.com (Ace Installer). I have been totally choc-a-block with installations recently (cos i offer them for free!), and i want to know if anyone could give me the code for how to do the following (so i can make a script that auto-chmods and uploadsd the files, which takes the longest time);

1) Login to a site
2) Upload files
3) CHMOD files

Yours

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: How to do this..... In reply to
Use FileMan.

Regards,

Eliot Lee
Quote Reply
Re: How to do this..... In reply to
Thanks for the suggestion; but what i want to do is have a script on my site (password protected, so only my installers can use it), and then let them upload the files and CHMOd them, then all they would need to do is set the variables in the scripts config. This is mainly for Links2, because it takes quite a long time to uplaod the files and then CHMOD them, but at Ethernet speeds it would be much quicker.

And ideas would be much appreciated.

A.J.Newby
http://ace.upyour.com



Quote Reply
Re: How to do this..... In reply to
And FileMan can't be used for that why?

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: How to do this..... In reply to
The reason i don't want to use it is because it only works on the server you install it to, not from my server to another remote one. Do you have any other script suggestions that may do this for me?

Yours

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: How to do this..... In reply to
Use Net::FTP to share data between different servers. Search http://www.perl.com or http://www.cpan.org for information on this module. OR search your perldocs in your server.

Regards,

Eliot Lee
Quote Reply
Re: How to do this..... In reply to
As AnthroRules said, Net::FTP is your best bet:

Code:
use Net::FTP;

$ftp = Net::FTP->new("some.host.name", Debug => 0);
$ftp->login("anonymous",'me@here.there');
$ftp->cwd("/pub");
$ftp->put("that.file");
$ftp->site("CHMOD 755 that.file");
$ftp->quit;
Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: How to do this..... In reply to
Where can i get the module from?

Thanks

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: How to do this..... In reply to
In Reply To:
Where can i get the module from?
Right here:
http://cpan.org/modules/index.html


easy does it
Quote Reply
Re: How to do this..... In reply to
Thanks. That code worked. Just one more question, how do i delete files? Would i put
$ftp->dele("test.file");
or something else?

Thanks for the support so far.

Yours
A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: How to do this..... In reply to
Hi. Thanks for the support earlier. I was just wondering if you could tell me how to make a directory using the code you gave me. I have worked out how the use 'cdup' and 'cwd', but the 'mkd' doesn't seem to work. I have used the following code;
$ftp->mkd("links");
but it doesn't work!

Also, is it possible to upload whole folders? And if so how can i do this?

Any help would be much appreciated.

Yours

A.J.Newby
webmaster@youradds.com
http://ace.upyour.com

Quote Reply
Re: How to do this..... In reply to
See: perldoc Net::FTP

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: How to do this..... In reply to
Hi. I have tried to find these docs, but have had no success. Could you possibly point me in the right direction?

Thanks

A.J.Newby
webmaster@ace-installer.com
http://www.ace-installer.com

Quote Reply
Re: How to do this..... In reply to
Try

http://www.perldoc.com/perl5.6/lib/Net/FTP.html

Quote Reply
Re: How to do this..... In reply to
Thanks, that is great! There is everything i need here.

Yours

A.J.Newby
webmaster@ace-installer.com

Quote Reply
Re: How to do this..... In reply to
Just another one; why does this line of Net::FTP give me an error; Frown

$ftp->cdup();

If i comment out this line it all works OK. I had a look at the PerlDoc.com website http://www.perldoc.com/...5.6/lib/Net/FTP.html)
and this code was what they suggested. Please help me out!!!

Thanks

A.J.Newby
webmaster@ace-installer.com
http://www.ace-installer.com