473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Check files on 2 servers

Hi,

I want to create an executable that can check folders on 2 servers and
synchronize them if files dont match.
Can some one please point me to the right direction (sample code etc..)

Thanks in advance,
Stephen
Jan 9 '06 #1
1 1038
Dunno if I should =P

well I may have some pieces to you.
this will work on simple network:

for(int i=0;i<ServerID.Length;i++)
{
if(ServerID[i] != "")
{
if(Directory.Exists("\\\\" + dp + "\\" + pathToDp + "\\" +
ServerID[i] ))
{
table = new DataTable("\\\\" + dp + "\\" + pathToDp + "\\" +
ServerID[i]);
table.Columns.Add("File_Name",Type.GetType("System .String"));
getAllFilesAndFolders("\\\\" + dp + "\\" + pathToDp + "\\" +
ServerID[i] , "\\\\" + dp + "\\" + pathToDp + "\\" + ServerID[i] , ref
table);
ds.Tables.Add(table);
ServerID[i] = "";
}
}

private void getAllFilesAndFolders(string path , string baseRoot,ref
DataTable table)
{
DataRow row;
foreach(string s in Directory.GetDirectories(path) )
getAllFilesAndFolders(s,baseRoot,ref table);

string[] files = Directory.GetFiles(path);
foreach(string pkgFile in files)
{
row = table.NewRow();
row["File_Name"] = pkgFile.Replace(baseRoot,"");
table.Rows.Add(row);
}
}

well its not a working piece, need some fixes in some declarations.
Well what it does:
You put a path in the ServerID and it create a table with all the files
that are in the server, then all you have to do is create another table
with the files from the other server and compare then. Easy now right?

Jan 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
4
by: Samuel | last post by:
I am building an web application that will be hosted on load balanced servers (multiple front and one backen db). The application will have to allow users to upload files onto the server. For...
0
by: Missaka Wijekoon | last post by:
Folks, I have 3 mysql replicated servers ( 1 master + 2 slaves). One thing I noticed is that every once in a while the data (*.MYD) and index (*.MYI) files for a table may differ from the other...
10
by: Clive Backham | last post by:
I tried posting this on comp.infosystems.www.misc, but that group appears to get very little traffic. So now I'm trying here. If there is a more appropriate group, please let me know. I'm...
22
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
6
by: Richard Loupatty | last post by:
Hi all, Does someone know what this mean: The check of the signature failed for assembly 'Infragistics.WebUI.UltraWebGrid.v2' I also did a post to Infragistics but maybe this is a general...
9
by: tshad | last post by:
This is similar to another post I did where I would like to check one server from another server programmatically (from a service) to see if it is running and then act accordingly if it isn't. ...
3
by: Ben Holness | last post by:
Hi all, I have a php/mysql website where people can upload their own graphics for the buttons and background of pages on the website. This used to run on one server, but I have now been asked...
28
by: SzH | last post by:
Suppose that there is a program that takes two files as its command line arguments. Is there a (cross platform) way to decide whether the two files are the same? Simple string comparison is not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.