Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
13.5k views
in Java FTP by (160 points)
I have a process that opens an ftp session with an ftp server using FTPClient, creates a temporary directory on the server, loads a seried of files into the temporary directory, then renames the temporary directory to the directory that it should be. Everything works fine until I try to rename the directory to its permanent name using FTPClient.rename(). The call throws an FTPException with a message of 'File Exists'. :?
I tried using the windows command line ftp to rename the file and it does it without a problem, though it does show the File Exists line coming from the RNFROM ftp command when I turn on debug.
Is the FTPClient.rename() method catching this message from RNFROM and interpreting it as an error?
I'm using version 1.4.4 of edtftpj.
Any help would be appreciated.

6 Answers

0 votes
by (161k points)
Are you sure the permanent directory name doesn't exist previously?

Does it actually succeed in renaming like the command line does (sounds like they are both getting the same error)?

edtFTPj doesn't interpret messages being sent back - the FTP server must be sending an error code as well.

If it really is succeeding (and thus the FTP server is buggy), your only option is to catch the FTPException, and check for the error code in it. If you have determined it is ok, then ignore it.

I have a process that opens an ftp session with an ftp server using FTPClient, creates a temporary directory on the server, loads a seried of files into the temporary directory, then renames the temporary directory to the directory that it should be. Everything works fine until I try to rename the directory to its permanent name using FTPClient.rename(). The call throws an FTPException with a message of 'File Exists'. :?
I tried using the windows command line ftp to rename the file and it does it without a problem, though it does show the File Exists line coming from the RNFROM ftp command when I turn on debug.
Is the FTPClient.rename() method catching this message from RNFROM and interpreting it as an error?
I'm using version 1.4.4 of edtftpj.
Any help would be appreciated.
0 votes
by
Are you sure the permanent directory name doesn't exist previously?

Yes, it does not exist.

Does it actually succeed in renaming like the command line does (sounds like they are both getting the same error)?

No.

edtFTPj doesn't interpret messages being sent back - the FTP server must be sending an error code as well.

I'll have to check to see if I can interpret the error code and will see if there is a way that I can work around it.
0 votes
by (160 points)
When I run on my development machine (which has the server and client running on it) the rename works without a problem. :o
When I run on our test machines (where the client and server are on two different machines) I get the above results. I checked on our test machine and it is returning a reply code of 553 (File Exists). If I log onto the server via command line (Windows 2000 pro) from the client machine, I can rename the directory without a problem. :shock:
0 votes
by (161k points)
Is the FTP server the same in each instance?

When I run on my development machine (which has the server and client running on it) the rename works without a problem. :o
When I run on our test machines (where the client and server are on two different machines) I get the above results. I checked on our test machine and it is returning a reply code of 553 (File Exists). If I log onto the server via command line (Windows 2000 pro) from the client machine, I can rename the directory without a problem. :shock:
0 votes
by
Is the FTP server the same in each instance?

Yes

I'm using GuildFTPd Version 0.999.12.
0 votes
by (161k points)
It seems that to rename using GuildFTPd, the user needs delete permissions.

http://www.guildftpd.com/phpBB2/viewtop ... ght=rename

I suspect that where it is failing, your user does not have delete permissions.

Is the FTP server the same in each instance?

Yes

I'm using GuildFTPd Version 0.999.12.

Categories

...