Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.

editFTPj delete problems

no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

editFTPj delete problems

by wiki » Fri Nov 04, 2011 8:06 am

no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: editFTPj delete problems

by support2 » Fri Nov 04, 2011 10:58 am

no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Sat Nov 05, 2011 1:13 am

so i put logging in my code, and here's what I get:

DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 19:47:51.121 : Connecting
DEBUG [FileTransferClient] 4 Nov 2011 19:47:51.122 : Configured client
DEBUG [FTPClient] 4 Nov 2011 19:47:51.123 : Connecting to /192.168.0.100:21
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.128 : 220 Microsoft FTP Service
DEBUG [FileTransferClient] 4 Nov 2011 19:47:51.128 : Client connected
DEBUG [FileTransferClient] 4 Nov 2011 19:47:51.129 : Logging in
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.129 : ---> USER viki
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.131 : 331 Password required for viki.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.131 : ---> PASS ********
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.135 : 230 User viki logged in.
DEBUG [FileTransferClient] 4 Nov 2011 19:47:51.135 : Logged in
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.135 : ---> TYPE I
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.137 : 200 Type set to I.
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 19:47:51.137 : Connected
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 19:47:51.137 : deleting.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.137 : ---> CWD user_podatki
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.139 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.140 : ---> CWD enalozbe
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.142 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.142 : ---> CWD prejete_fakture
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.144 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.145 : ---> CWD 01
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.147 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.148 : ---> DELE 2011_00000000_RACUN.jpg
DEBUG [FTPControlSocket] 4 Nov 2011 19:47:51.151 : 550 2011_00000000_RACUN.jpg : The system cannot find the path specified.
INFO [FTPControlSocket] 4 Nov 2011 19:47:51.152 : Expected reply codes = [200,250]

The program connects to server correctly and also changes directories to get to the folder named 01, where the file 2011_00000000_RACUN.jpg is located... I can upload files to the server with no problems (i uploaded this particular .jpg file as well) and I checked my permissions and I have full control over all these folders. The name of the file is ok, so I really don't have any idea what is wrong. I hope I got logging right and that u can help me with this...
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sat Nov 05, 2011 5:13 am

Could you also post the log of when it succeeds? It would also be useful to call dirDetails() prior to the delete so we can see the directory listing.
no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Sat Nov 05, 2011 6:27 am

here's the log when the file is deleted: (the name is a bit different, but 2011_00000001_RACUN and 2011_00000003_RACUN both exist in the same folder.

DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 21:26:16.047 : Connecting
DEBUG [FileTransferClient] 4 Nov 2011 21:26:16.048 : Configured client
DEBUG [FTPClient] 4 Nov 2011 21:26:16.048 : Connecting to /192.168.0.100:21
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.052 : 220 Microsoft FTP Service
DEBUG [FileTransferClient] 4 Nov 2011 21:26:16.052 : Client connected
DEBUG [FileTransferClient] 4 Nov 2011 21:26:16.052 : Logging in
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.052 : ---> USER viki
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.054 : 331 Password required for viki.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.054 : ---> PASS ********
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.056 : 230 User viki logged in.
DEBUG [FileTransferClient] 4 Nov 2011 21:26:16.057 : Logged in
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.057 : ---> TYPE I
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.059 : 200 Type set to I.
Connected to FTP server.
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 21:26:16.059 : Connected
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.059 : ---> CWD user_podatki
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.061 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.061 : ---> CWD enalozbe
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.064 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.064 : ---> CWD prejete_fakture
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.066 : 250 CWD command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.066 : ---> CWD 01
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.068 : 250 CWD command successful.
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 21:26:16.068 : deleting.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.068 : ---> DELE 2011_00000003_RACUN.jpg
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.071 : 250 DELE command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.072 : ---> QUIT
DEBUG [FTPControlSocket] 4 Nov 2011 21:26:16.074 : 221
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 21:26:16.074 : deleted.

And here's what happens if i try to cal method directoryList("01"), where 01 is the folder with the .jpg files. That's how the call of the method looks like:
log.debug("dir. details:");
FTPFile[] directoryList = ftpDelete.directoryList(comCode);
log.debug("end of dir details");
log.debug("deleting.");
//sedaj smo v pravi mapi v kateri bomo pobrisali file z imenom imeScana
//ftpDelete.deleteFile(imeScana);
ftpDelete.deleteFile("2011_00000004_RACUN.jpg");
//na koncu se zapremo povezavo
ftpDelete.disconnect();
log.debug("deleted.");

and here's the log:
DEBUG [virtcomui.VirtcomGUIOsnova] 4 Nov 2011 21:29:49.600 : dir. details:
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.600 : ---> SYST
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.602 : 215 Windows_NT
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.602 : ---> PWD
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.605 : 257 "/user_podatki/enalozbe/prejete_fakture/01" is current directory.
DEBUG [FTPClient] 4 Nov 2011 21:29:49.605 : setupDirDetails(01) returning: /user_podatki/enalozbe/prejete_fakture/01/01
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.605 : ListenOnAllInterfaces=true
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.606 : ---> PORT 192,168,0,62,112,79
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.608 : 200 PORT command successful.
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.608 : ---> LIST 01
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.610 : 150 Opening BINARY mode data connection for /bin/ls.
DEBUG [FTPActiveDataSocket] 4 Nov 2011 21:29:49.610 : Calling accept()
DEBUG [FTPActiveDataSocket] 4 Nov 2011 21:29:49.612 : accept() succeeded
DEBUG [FTPActiveDataSocket] 4 Nov 2011 21:29:49.612 : closeChild() succeeded
DEBUG [FTPActiveDataSocket] 4 Nov 2011 21:29:49.612 : close() succeeded
DEBUG [FTPControlSocket] 4 Nov 2011 21:29:49.816 : 550 01: The system cannot find the file specified.
INFO [FTPControlSocket] 4 Nov 2011 21:29:49.816 : Expected reply codes = [226,250]
com.enterprisedt.net.ftp.FTPException: 550 01: The system cannot find the file specified. //here the program stops and throws an exception
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(FTPControlSocket.java:1223)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3726)
at com.enterprisedt.net.ftp.FTPClient.dir(FTPClient.java:3756)

It obviously has some problems with the directoryList, since it doesn't come to the "end of dir details" part...
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sat Nov 05, 2011 11:15 am

Just call dirDetails("") - you can't supply 01 as the parameter if you are already in that directory.
no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Sat Nov 05, 2011 7:36 pm

I don't have the method dirDetails(), so i called directoryList("") and here's the log:
DEBUG [virtcomui.VirtcomGUIOsnova] 5 Nov 2011 10:29:48.166 : dir. details:
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.166 : ---> SYST
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.167 : 215 Windows_NT
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.168 : ---> PWD
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.171 : 257 "/user_podatki/enalozbe/prejete_fakture/01" is current directory.
DEBUG [FTPClient] 5 Nov 2011 10:29:48.171 : setupDirDetails() returning: /user_podatki/enalozbe/prejete_fakture/01
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.171 : ListenOnAllInterfaces=true
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.172 : ---> PORT 192,168,0,62,118,179
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.174 : 200 PORT command successful.
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.174 : ---> LIST
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.176 : 150 Opening BINARY mode data connection for /bin/ls.
DEBUG [FTPActiveDataSocket] 5 Nov 2011 10:29:48.176 : Calling accept()
DEBUG [FTPActiveDataSocket] 5 Nov 2011 10:29:48.178 : accept() succeeded
DEBUG [FTPActiveDataSocket] 5 Nov 2011 10:29:48.178 : closeChild() succeeded
DEBUG [FTPActiveDataSocket] 5 Nov 2011 10:29:48.179 : close() succeeded
DEBUG [FTPControlSocket] 5 Nov 2011 10:29:48.377 : 226 Transfer complete.
DEBUG [FTPFileFactory] 5 Nov 2011 10:29:48.378 : Confirmed format Windows
DEBUG [virtcomui.VirtcomGUIOsnova] 5 Nov 2011 10:29:48.380 : end of dir details

If i print out the directory list that this method returns, it looks like this: - the list is ok.
F: 11-04-11 08:22PM 1040112 2011_00000002_RACUN.jpg
Name=2011_00000002_RACUN.jpg,Size=1040112,Permissions=null,Owner=null,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=04-11-2011 20:22
F: 11-04-11 08:59PM 539557 2011_00000005_RACUN.jpg
Name=2011_00000005_RACUN.jpg,Size=539557,Permissions=null,Owner=null,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=04-11-2011 20:59
F: 11-04-11 10:36PM 544147 2011_00000006_RACUN.jpg
Name=2011_00000006_RACUN.jpg,Size=544147,Permissions=null,Owner=null,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=04-11-2011 22:36
F: 11-04-11 10:46PM 539557 2011_00000099_RACUN.jpg
Name=2011_00000099_RACUN.jpg,Size=539557,Permissions=null,Owner=null,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=04-11-2011 22:46
F: 11-04-11 10:36PM 539557 2011_00000567_RACUN.jpg
Name=2011_00000567_RACUN.jpg,Size=539557,Permissions=null,Owner=null,Group=null,Is link=false,Link count=1.Is dir=false,Linked name=null,Last modified=04-11-2011 22:36
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sat Nov 05, 2011 8:45 pm

There has to be something simple going on here but I can't see what it is. Post the output of this (using the filename/dir that fails):

client.changeDirectory("dir1");
String fileName = "file1.jpg";
try {
client.deleteFile(fileName);
}
catch (FTPException ex) {}
client.deleteFile("file1.jpg");
client.disconnect();
no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Sun Nov 06, 2011 2:31 am

Here's what the code looks like now:
ftpDelete.changeDirectory(comCode); //comCode is my directory
log.debug("deleting.");
String filename = preberiPropertiesFile("scanName");
try{
ftpDelete.deleteFile(filename);
}
catch(FTPException ex){}
ftpDelete.deleteFile(filename);
ftpDelete.disconnect();

And here's the log:

DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.830 : ---> CWD 01
DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.832 : 250 CWD command successful.
DEBUG [virtcomui.VirtcomGUIOsnova] 5 Nov 2011 17:27:00.832 : deleting.
DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.832 : ---> DELE 2011_00000005_RACUN.jpg
DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.835 : 550 2011_00000005_RACUN.jpg : The system cannot find the path specified.
INFO [FTPControlSocket] 5 Nov 2011 17:27:00.836 : Expected reply codes = [200,250]
DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.836 : ---> DELE 2011_00000005_RACUN.jpg
DEBUG [FTPControlSocket] 5 Nov 2011 17:27:00.840 : 550 2011_00000005_RACUN.jpg : The system cannot find the path specified.
INFO [FTPControlSocket] 5 Nov 2011 17:27:00.840 : Expected reply codes = [200,250]

I'm reading filename from a .properties file, if that could maybe cause problems?? But then I also read directoryName (comCode) from properties and it works fine...
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Sun Nov 06, 2011 5:18 am

Please put the filename explicitly the second time (the way you said it works). That way we will know what was sent to the server for the successful and failed deletes.
no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Sun Nov 06, 2011 9:37 am

DEBUG [virtcomui.VirtcomGUIOsnova] 6 Nov 2011 00:35:37.815 : deleting.
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.816 : ---> DELE 2011_00000005_RACUN.jpg
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.819 : 550 2011_00000005_RACUN.jpg : The system cannot find the path specified. //if I call ftp.deleteFile(fileName);
INFO [FTPControlSocket] 6 Nov 2011 00:35:37.819 : Expected reply codes = [200,250]
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.819 : ---> DELE 2011_00000005_RACUN.jpg //if I call ftp.deleteFile("2011_00000005_RACUN.jpg");
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.823 : 250 DELE command successful.
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.823 : ---> QUIT
DEBUG [FTPControlSocket] 6 Nov 2011 00:35:37.825 : 221
DEBUG [virtcomui.VirtcomGUIOsnova] 6 Nov 2011 00:35:37.825 : deleted.
no avatar
User

wiki

Posts

7

Joined

Fri Nov 04, 2011 7:54 am

by wiki » Thu Nov 10, 2011 7:04 pm

So do you have any idea what could be wrong?
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Thu Nov 10, 2011 11:00 pm

They look identical. Try trim()ing away spaces perhaps?

Who is online

Users browsing this forum: No registered users and 90 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron