Solved

Copy non-existing file from server machine

Posted on 2004-09-01
6
232 Views
Last Modified: 2010-03-31
E.g. I have 2 same folder at client and server called "backup", now i want to copy all the files from server to client (those files are not exist in client). The file should include sub directory and sub directory's files.

The copy program should locate at client machine.

thanks
0
Comment
Question by:hawkly
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Accepted Solution

by:
expertmb earned 39 total points
ID: 11960371
0
 
LVL 92

Assisted Solution

by:objects
objects earned 37 total points
ID: 11960955
use the following to copy from one stream to another (in your case you file stream):

public static copyStream(InputStream in, OutputStream out)
{
   int n = 0;
   byte[] buf = new byte[1024];
   while (-1!=(n=in.read(buf)))
   {
      out.write(buf, 0, n);
   }
   out.close();
   in.close();
}

How will the client be accessing the files on the server?
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 37 total points
ID: 11961180
> How will the client be accessing the files on the server?

This is the most important question...

You can do this via FTP, RMI or something like a servlet...

Each solution requires a different server setup, but without them you cannot just copy files off one machine to another
0
 
LVL 11

Assisted Solution

by:cjjclifford
cjjclifford earned 37 total points
ID: 11961571
have a look into RSYNC (http://samba.anu.edu.au/rsync/), it is for synchronizing the same data onto multiple machines, this might work for your approach... otherwise use FTP(various Java FTP libraries available that allow browsing directories) to get a list of remote files, and fetch those that do not exist locally (also take care of changes to remote files, i.e. check timestamp or remote files and keep track of when local files were synchronized!)
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question