Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Commons FTPClient, check if remote directory exist and get permissions (linux - unix)

Is it possible with FTPClient (Apache commons-net) to check if a remote directory exists?

I want to do something like this:

ftp.isDirectory(String path) //returns true, false

And then get permissions (chmod) of directory:

ftp.getPermisions(String path) //returns -rwxr-xr-x 
like image 838
Xerg Avatar asked Dec 21 '10 14:12

Xerg


1 Answers

Try to change the working directory to the directory you need to check:

boolean directoryExists = FTPClient.changeWorkingDirectory("path/to/somedir")
like image 77
Juris Avatar answered Sep 25 '22 13:09

Juris