Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.8k views
in Java FTP by (260 points)
Hi All,

I am using the trial version of the enterprisedt, edtftpj-pro.jar.
I am trying to delete a file in the server, which is located in my
linux server at /var/ftp/pub/xyz/abc/test.wav.

I am using below code, but I could not delete it.


SecureFileTransferClient client = new SecureFileTransferClient();
client.setRemoteHost(host);
client.setUserName(username);
client.setPassword(password);
client.setProtocol(Protocol.FTP); // FTP is the default
client.connect();
client.changeDirectory("/var/ftp/pub/xyz/abc/");
client.deleteFile("test.wav");
client.disconnect();

I am getting this exception.

com.enterprisedt.net.ftp.FTPException: Delete operation failed.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.delete(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.DeleteFileTask.run(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$_A.run(Unknown Source)


can some one point me to sample code, which has exact filename
and its location formats specificed.

Any help is highly Appreciated.

Thanks & Regards,
Venkat.

3 Answers

0 votes
by (162k points)
Please post the log file (see the Dev Guide for details).

I'm not sure that changing to /var/ftp/pub/xyz/abc/ will successful - can you do it with a command line FTP client?
0 votes
by (260 points)
Hi,

Thanks for your quick reply.

Here is my log details.

INFO [FTPThreadPool] 3 Jul 2008 10:32:16.0 : Processing task 1:Connect[xxx.xxx.x.xx:21]
INFO [LicensePropertiesBase] 3 Jul 2008 10:32:16.46 : Licence expiry date: 08 Aug 2008
INFO [LicensePropertiesBase] 3 Jul 2008 10:32:16.46 : Trial licence
INFO [ConnectFTPTask] 3 Jul 2008 10:32:16.93 : Logged in
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Starting FTPKeepAlive thread
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Processed task 1:Connect[xxx.xxx.x.xx:21]
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Freed connection for task 1
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Task 1 complete (FTPThread[FTPThread_edt_0])
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Processing task 2:ChangeDirectory[null]
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Processed task 2:ChangeDirectory[/var/ftp/pub/xyz/abc/]
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Freed connection for task 2
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.93 : Task 2 complete (FTPThread[FTPThread_edt_2])
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.109 : Processing task 3:Delete[test.wav]
INFO [FTPControlSocket] 3 Jul 2008 10:32:16.109 : Expected reply codes = [200,250]
ERROR [DeleteTask] 3 Jul 2008 10:32:16.109 : 3:Delete[test.wav] failed : Delete operation failed.
com.enterprisedt.net.ftp.FTPException: Delete operation failed.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.delete(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.DeleteFileTask.run(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$_A.run(Unknown Source)


com.enterprisedt.net.ftp.FTPException: Delete operation failed.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.delete(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.DeleteFileTask.run(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$_A.run(Unknown Source)

WARN [FTPThreadPool] 3 Jul 2008 10:32:16.109 : Exception thrown in callback: Delete operation failed. : Delete operation failed.
com.enterprisedt.net.ftp.FTPException: Delete operation failed.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.delete(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.DeleteFileTask.run(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$_A.run(Unknown Source)


com.enterprisedt.net.ftp.FTPException: Delete operation failed.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.delete(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.DeleteFileTask.run(Unknown Source)
at com.enterprisedt.net.ftp.async.internal.FTPTaskProcessor$_A.run(Unknown Source)

INFO [FTPThreadPool] 3 Jul 2008 10:32:16.109 : Processed task 3:Delete[test.wav]
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.109 : Freed connection for task 3
INFO [FTPThreadPool] 3 Jul 2008 10:32:16.109 : Task 3 complete (FTPThread[FTPThread_edt_2])


Any help is highly Appreciated.

Thanks & Regards,
Venkat.
0 votes
by (162k points)
Please set the level of logging to ALL.

It looks like your user does not have permission to delete this file - the server is sending back an error message.

Can you perform this operation in another client?

Categories

...