Error in delete file using NET:FTP module

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am very new to perl. I use following script to delete a file on ftp
$ftpobj -> delete($fileName) or $newerr=1;
print "cannot delete $fileName:$!\n" if $newerr;

However, it works on windows, but does not work on linux. On linux, $!
even returns empty string, so i have no way to find out what's wrong.
the file just cannot be deleted.

Does anyone know what's going on?
thanks a bunch!

Re: Error in delete file using NET:FTP module

after researching net ftp module, i used -> message to get latest error
message and it says 'DELE ': Invalid number of parameters.

But I do provide the filename correctly. And I have also tried to run
delete command by manually ftp to server from linux terminal and file
can be deleted just fine. What went wrong here.

Thanks again,

Re: Error in delete file using NET:FTP module

Quoted text here. Click to load it

I don't know why you're getting this problem. Is there something unusual in
the filename that could lead to the server perceiving it as more than one
argument ?

Could you post (copy'n'paste) a complete (minimal) script that demonstrates
the problem. (Change any 'username' and 'password' info ... and hostname,
too, if you want - but leave everything else as it is.)

Also, turn on debugging when you create $ftpobj:

my $ftpobj = Net::FTP->new("", Debug => 1)

I don't know if that will provide anything more useful than '$ftpobj ->
message', but it might help.


Re: Error in delete file using NET:FTP module

thanks for the hint, I found out what's wrong here. After applying
double quote around $fileName, this runs nicely in linux.

Site Timeline