I am making a JTree that loads files and folder of a FTP Server, using (Apache Commons). I use this method to load files of a specific directory:
FTPFile[] innerFiles = ftp.listFiles();
I noticed that for any directory, innerFiles [0]
is .
and innerFiles [1]
is ..
It is easy to ignore them by start looking from innerFiles[2], but I just want to know what are these reserved items for and would it make any problem in case of ignoring them?
Those files represent the current directory (.
) and the directory above it (..
). You should ignore these when creating a tree structure showing all the files and directories.
You could specify a FTPFileFilter
that strips these out.