how to copy the directory from the source.
1 posts in topic
Flat View  Flat View

Posted By:   Abdul_Kareem
Posted On:   Sunday, March 23, 2003 02:58 PM

iam developing a ftp software in java, in that i want to copy and read a directory contain files and subdirectory from client
to server,
i used the Fileinputstream for directory reading, but it only support the files not directory,
so which class is used for reading a directory and copying........ is there any ftp seperate class?
please clarify my doubt, i will very grate ful to u.
yours truely,

Re: how to copy the directory from the source.

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, March 24, 2003 09:44 AM

For copying files from a subdirectory, in ftp, usually for most ftp servers, unless I'm missing some recent developments in the protocol, you have to go in and copy each one, one at a time. There's no "copy recursively, directory and all files + subdirectories" command, in the ftp protocol, unfortunately.

So, typically you have to manually make all the directories and subdirectories first, to match what's on the server. And then you just fetch the files, since the matching directories already exist locally.

Some ftp servers (the "wuftpd" was the classic, free reference, but perennially buggy & insecure, implementation) do provide extensions to the basic ftp protocol, that will let you do something else. Some will even let you fetch a tarball, which they make on the fly, for instance. e.g. If you find that there is a directory on the server named "foo", some ftp servers will honor a request for "foo.tar.gz" and will generate it on the fly for you, tarring and gzipping the contents, recursively, of the foo directory.

Then once you fetch the tarball, of course you have to manually gunzip and untar it yourself, locally.

About | Sitemap | Contact