ftp-client

Apache Commons FTPClient.listFiles

狂风中的少年 提交于 2019-11-30 06:13:17
I am using org.apache.commons.net.ftp.FTPClient in one of my applications to work with a FTP server. I am able to connect , login , pwd and cwd . However, when I try to list the files it doesn't return the list of files in that directory, where I know for sure that there are files. I am using the method FTPFile[] listFiles() , it returns an empty array of FTPFile . Please find below the code snippet where I am trying this: String hostname = properties.getProperty("FTP_SERVER"); String user = properties.getProperty("FTP_USER"); String passwd = properties.getProperty("FTP_PASSWD"); FTPClient

Too many FTP connections, can't accept more

╄→尐↘猪︶ㄣ 提交于 2019-11-30 06:03:57
问题 I got the following error message: Warning: ftp_login(): I can't accept more than 6 connections as the same user in C:\xampp\htdocs\test\ftp_sync.php on line 58 My code which causes the error: function newStream($i){ $conId = ftp_connect($this->ftpServer); // login with username and password $login_result = ftp_login($conId, $this->ftpUsername, $this->ftpPassword);//line 58 // /home/content/61/10367861/html/ // turn passive mode on ftp_pasv($conId, true); $this->conIds[$i]=$conId; $this-

Apache Commons FTPClient Hanging

耗尽温柔 提交于 2019-11-30 04:50:34
We are using the following Apache Commons Net FTP code to connect to an FTP server, poll some directories for files, and if files are found, to retrieve them to the local machine: try { logger.trace("Attempting to connect to server..."); // Connect to server FTPClient ftpClient = new FTPClient(); ftpClient.setConnectTimeout(20000); ftpClient.connect("my-server-host-name"); ftpClient.login("myUser", "myPswd"); ftpClient.changeWorkingDirectory("/loadables/"); // Check for failed connection if(!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { ftpClient.disconnect(); throw new

Android app doesn't work on Android 4

不羁的心 提交于 2019-11-29 17:57:16
I created an Android project on 2.3.3 and tried it on mobile 2.3.3, everything works OK. It didn't work on mobile 4, so I re-built for Android 4, but I have the same problem. This is the code: public void FTP_Download(){ String server = "192.168.1.135"; int port = 21; String user = "pc1"; String pass = "1551"; FTPClient ftpClient = new FTPClient(); try { ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); Toast.makeText(getBaseContext(), "download starting.",Toast.LENGTH_LONG).show(); // APPROACH #1:

FTPClient.listFiles not working

我怕爱的太早我们不能终老 提交于 2019-11-29 11:22:13
I am trying to list all the files under a specific directory in a ftp server. FTPFile[] subFiles = ftpClient.listFiles("directory"); Although the directory is a valid one , but the code gets stuck while calling listFiles , what may be the reason. ? Further i would like to mention that a seperate netbeans project accessing the same FTP server is working fine with the same code , but a maven project is having the problem. please help. Try to use passive mode . I assume that you are using the newest commons net library (you didn't write which lib you are using). Next approach, try to change the

Issue with org.apache.commons.net.ftp.FTPClient listFiles()

余生长醉 提交于 2019-11-29 10:32:47
The listFiles() method of org.apache.commons.net.ftp.FTPClient works fine with Filezilla server on 127.0.0.1 but returns null on the root directory of public FTP servers such as belnet.be. There is an identical question on the link below but enterRemotePassiveMode() doesn't seem to help. Apache Commons FTPClient.listFiles Could it be an issue with list parsing? If so, how can go about solving this? Edit: Here's a directory cache dump: FileZilla Directory Cache Dump Dumping 1 cached directories Entry 1: Path: / Server: anonymous@ftp.belnet.be:21, type: 4096 Directory contains 7 items: lrw-r--r-

Apache Commons FTPClient.listFiles

坚强是说给别人听的谎言 提交于 2019-11-29 06:04:36
问题 I am using org.apache.commons.net.ftp.FTPClient in one of my applications to work with a FTP server. I am able to connect , login , pwd and cwd . However, when I try to list the files it doesn't return the list of files in that directory, where I know for sure that there are files. I am using the method FTPFile[] listFiles(), it returns an empty array of FTPFile . Please find below the code snippet where I am trying this: String hostname = properties.getProperty("FTP_SERVER"); String user =

parsing a date string from FTPClient.getModificationTime()

亡梦爱人 提交于 2019-11-28 14:16:54
I am trying to parse a date string which is a modification date of a file on FTP server. Following is the code. String dateString = mFTPClient.getModificationTime(PDF_FILE_NAME_PS); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); Date modificationDate = dateFormat.parse(dateString.substring(dateString.indexOf(" "))); Log.v(TAG, "inside downloadservice dateString="+dateString); Log.v(TAG, "inside downloadservice modificationdate="+modificationDate.toString()); I get this in my log 05-27 10:04:20.870: V/DownloadService(751): inside downloadservice dateString=213

Too many FTP connections, can't accept more

删除回忆录丶 提交于 2019-11-28 13:57:43
I got the following error message: Warning: ftp_login(): I can't accept more than 6 connections as the same user in C:\xampp\htdocs\test\ftp_sync.php on line 58 My code which causes the error: function newStream($i){ $conId = ftp_connect($this->ftpServer); // login with username and password $login_result = ftp_login($conId, $this->ftpUsername, $this->ftpPassword);//line 58 // /home/content/61/10367861/html/ // turn passive mode on ftp_pasv($conId, true); $this->conIds[$i]=$conId; $this->localFiles[$i]=''; $this->conStats[$i]=FTP_FAILED;//initial value } Does anyone probably know what this

How can FTPClient delete a directory?

安稳与你 提交于 2019-11-28 13:00:24
I want to delete a folder in FTP. Can FTPClient object delete it? FtpWebRequest provides the Delete action. Here is a piece of code to achieve that : FtpWebRequest reqFTP = FtpWebRequest.Create(uri); // Credentials and login handling... reqFTP.Method = WebRequestMethods.Ftp.DeleteFile; string result = string.Empty; FtpWebResponse response = reqFTP.GetResponse(); long size = response.ContentLength; Stream datastream = response.GetResponseStream(); StreamReader sr = new StreamReader(datastream); result = sr.ReadToEnd(); sr.Close(); datastream.Close(); response.Close(); It should work on files