Hi,
I'm writing an application which has to delete a file on a remote server. The problem, which I can't seem to solve is the following: I have the name of the file stored in a variable called fileName (type String). The name stored in the variable is correct, i checked it and compared it to the actual file name on the server and it's ok. The problem is, that if I call the client.deleteFile(fileName) method like this, it doesn't work, but if i call it this way: client.deleteFile("thename.jpg") it works. And the string and the variable are the same... I don't know what could be wrong. Everything is fine with the connection, I'm able to upload the file and it all works fine except for this... I also thought maybe the problem was that I was in the wrong directory, but it's all fine.
Here's the code snippet:
//before this i set up the connection
ftpDelete.changeDirectory("dir1"); //my directory where file is located
String fileName = "file1.jpg"; //file name
//deleting
client.deleteFile(fileName); //this doesn't work but this does: client.deleteFile("file1.jpg");
//disconnect
client.disconnect();
And here's what I get as an output in the console:
SEVERE: null
com.enterprisedt.net.ftp.FTPException: 550 2011_00000001_RACUN.jpg : The system cannot find the path specified.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:1223)
at com.enterprisedt.net.ftp.FTPClient.delete(FTPClient.java:3884)
at com.enterprisedt.net.ftp.FileTransferClient.deleteFile(FileTransferClient.java:957)
at virtcomui.VirtcomGUIOsnova.brisiNaServerju(VirtcomGUIOsnova.java:2497)
at virtcomui.VirtcomGUIOsnova.brisiIkonaActionPerformed(VirtcomGUIOsnova.java:2447)
at virtcomui.VirtcomGUIOsnova.access$1500(VirtcomGUIOsnova.java:60)
at virtcomui.VirtcomGUIOsnova$21.actionPerformed(VirtcomGUIOsnova.java:748)
please, help, because it's driving me crazy...