aspose file tools*
The moose likes Other Open Source Projects and the fly likes Commons net Ftpclient listfiles problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Commons net Ftpclient listfiles problem" Watch "Commons net Ftpclient listfiles problem" New topic
Author

Commons net Ftpclient listfiles problem

Ramesh Nuthalapati
Greenhorn

Joined: Mar 04, 2009
Posts: 4
Hi, i am having an issue with ftpClient.listFiles method.

files = ftpClient.listFiles(ftpFolderName); -- returns all the files in the folder

fileNames = ftpClient.listNames(); -- list all file names in the folder

Lets say i have files name in the folder as

.
..
a.txt
b.txt
c.txt
d.txt

listfiles loaded everything in the directory.

I need timestamp of all txt files, so what i had done is trying to get timestamp of FTPFiles.getTimestamp of first element which gives me "." (dir) timestamp.

listNames gives the index as 4. when I get timestamp on index 0 then its "." timestamp. where as when i do files[i].getName with index 0 it shows a.txt which is correct.

How do i tell listFiles not to include . and .. folders in code ?

Thanks for your help.
Ramesh
Ramesh Nuthalapati
Greenhorn

Joined: Mar 04, 2009
Posts: 4
I did a hack by refiltering the files by excluding . and .. and kept the rest of files into another ftpfiles[].

That solved for now.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Commons net Ftpclient listfiles problem
 
Similar Threads
reading a dynamic file...
About deleting files using listFiles()
How i can get Folder Explorer
Getting A File List From A Directory
creating jar file programatically