Solved

Copy non-existing file from server machine

Posted on 2004-09-01
6
198 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now