Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3k views
in Java FTP by (160 points)
Hi All,

i'm new to using edtftpj and would like to know if there is any method to check if the given filename exists in the directory.

Also to check if a particular directory exists ...

my requirement is that i am transferring files from one ftp server to another and i want to move all processed files to archive... before moving to archive i want to check if the archive directory exists ..

kindly help...

thanks very much.

Umesh

2 Answers

0 votes
by (51.6k points)
The easiest way is to use the dirDetails() method to get a listing of all the files and then see if the file you're interested in is there. Some servers allow you to specify a file- or directory-name so that you can use the method dirDetails("myFilename") to get the details for just that file instead of getting all of the files in that directory.

- Hans (EDT)
0 votes
by (160 points)
Thank you very much for the reply...

Currently i'am using the dir("dir_path",boolean ) to get the files and then to see if the filename matches the given pattern i need to transfer ... the steps i'm following in my program is as follows ..

1) i am listing all the files which i need to transfer to remove ftp server,
2) then moving the files to local host where my program is running.
3) then i am transferring/putting the files to the remote ftp server ..

In each of the above steps i want to check if the file/directory exists ..before getting or putting the file ..
while putting the file if the directory doesn't exists i want to create the directory .. all the details .. like pattern of filename, hostname, directory, user details etc., i'm taking them dynamically ..

so i was looking for a simple method which would return a boolean value .. currently i'm using quote() method and checking for the return string ...

require your suggestions to make the program efficient and less complex .. any tips will be of great help ..

thanks and regards,
Umesh

Categories

...