Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Jesse Black   on May 28 In Java Category.

  
Question Answered By: Andrew Bryant   on May 28

In FTPClient class listFiles() method is not returning list of files
it doesnot give any compiletime error but on execution gives null
pointer exception.

Actually i want to manipulate files based on their size.

piece of code is:

FTPFile files[] = ftc.listFiles();
for(int i=0;i<files.length;i++)
{
FTPFile file = files[i];
System.out.println("File Size:"+file.getSize());
if((name.endsWith("."))||(name.endsWith(".."))){}
else{
if(name.indexOf(".")!=-1)
{
if(name.endsWith(type))
{
if(files[i].getSize()<size)
FileOutputStream fos = new FileOutputStream(new File
("c:\\download\\",name));
ftc.retrieveFile(name,fos);
}
}
}
}




Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on problem while trying to make an applet Or get search suggestion and latest updates.


Tagged: