Janardhanan, Ajith (AJANARDH)
Mon, 11 Feb 2008 13:42:19 -0800
I have the Apache ftp server embedded in my code and tweaked the code to
add a new onListStart() command. In the onListStart(), when the user
does an 'ls -l' command, I display a list, without actually going in to
the filesystem:
eg:
ftp> ls -l
200 PORT command successful
150 Opening ASCII mode data connection for file list.
200 PORT command successful
150 Opening ASCII mode data connection for file list.
-rw-r--r-- 1 ajith ftpctrl 128000 Feb 05 16:55
fileDOJ7gd.1202230507
-rw-r--r-- 1 ajith ftpctrl 7982 Feb 07 14:33
filenmfTNr.1202394783
226 Transfer Complete
remote: incoming
1125 bytes received in 0.026 seconds (42.82 Kbytes/s)
226 Transfer Complete
remote: -l
1125 bytes received in 0.026 seconds (42.82 Kbytes/s)
In my code, this is what I am doing:
public FtpletEnum onDirStart(FtpSession session, FtpRequest request,
FtpReplyOutput response)
{
String outputStr = "-rw-r--r-- 1 ajith ftpctrl 128000 Feb 05 16:55
fileDOJ7gd.1202230507\n
-rw-r--r-- 1 ajith ftpctrl 7982 Feb 07 14:33
filenmfTNr.1202394783\n";
DataConnection dataConnection =null;
response.write(new DefaultFtpReply(150, "Opening ASCII mode data
connection for file list."));
dataConnection = session.getDataConnection().openConnection();
dataConnection.transferToClient(outputStr);
response.write(new DefaultFtpReply(226, "Transfer Complete"));
}
Any idea who puts in the remote: -l line, I want to get rid of the line
in the user terminal.
Any help appreciated
Thanks
Ajith