Discuss (FTP) and (SFTP, FTPS and SCP), our Java file transfer clients.
no avatar
User

xiaoyu1985ban

Posts

30

Joined

Wed Mar 18, 2009 1:31 am

Can I know is it a file or directory directory?

by xiaoyu1985ban » Tue Apr 07, 2009 12:35 pm

I have got a remote directory called ftpPath,Is there someway I can know is it a file or directory directly through ftpPath,create a FTPFile object?
Thanks a lot !
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: Can I know is it a file or directory directory?

by support2 » Tue Apr 07, 2009 3:00 pm

If you list the parent directory using dirDetails(), that should tell you.
no avatar
User

xiaoyu1985ban

Posts

30

Joined

Wed Mar 18, 2009 1:31 am

by xiaoyu1985ban » Tue Apr 07, 2009 4:25 pm

Thanks for your answer.But I just don't know if it is a file or a directory on the remote server.
what I can only get is a path, like a method like this boolean fileOrDirectroy(String ftppath), true for file, false for directory
Any suggestion will be highly appreciated
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Tue Apr 07, 2009 8:37 pm

It isn't necessarily an easy thing to figure out.

The best approach is to use dirDetails() on the directory the file (or dir) is in, search through the FTPFile objects that are returned until you match the name, and see if it is a directory.
no avatar
User

xiaoyu1985ban

Posts

30

Joined

Wed Mar 18, 2009 1:31 am

by xiaoyu1985ban » Wed Apr 08, 2009 11:33 am


Who is online

Users browsing this forum: No registered users and 25 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign