Skip to content

Web Service???-->Newbie

Court Pavillard

Asked Sep 27, 2005, 12:06 PM EDT3 answers
Share
LinkedInX

First off, let me say that I'm very novice to C# and have done little with it.

I'm wanting to put together a Web Service that'll check the time stamp of all the files in a specific
folder and replace the same files in another folder IF that time stamp is later.  If the file 
(of the same name) is later in the destination folder, I don't want it to do anything.

I'm using this as a learning experience and I have gotten as far as opening a new Project in 
VS.NET 2003.  I was really hoping that ya'll might be able to point me to some 
sample "Web Service" code that I could use.  I don't want to have to buy a reference manual 
on this, but I'm wanting the same results.

Any suggestions, or would I be better off getting a C# reference Manual?  If so, 
what's a good one?  I've currently got WROX's Beginning ASP.NET 1.0 with C#

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0
    You may not want to put your email in signature. If any spider pick you up, you will be spamed.
    0
  • 0
    Hey, i would recommend getting a C# book along with your ASP.Net book. A lot of those books  presume you are familiar with C#. I recommend the books by O'Reilly. This one is good http://www.oreilly.com/catalog/progcsharp4/ As for your question what you want to do is get a FileInfo object for each file in the directory. Use the GetFiles method from the Directory class. This returns an array of string objects which are the names of the files in that directory. e.g. string[] allFiles = Directory.GetFiles(@"C:\DirectoryWhereFilesAre") ; foreach(string s in allFiles) { //Create a FileInfo object using the file name and the directory path FileInfo f = new FileInfo(@"C:\DirectoryWhereFilesAre\" + s ; //Do some comparison or whatever you want to do } Hope this helps, Clive.
    0
  • 0
    I am pretty new to the language myself and am working through creating a service as well. I found the following link on this site helpful in at at least understanding where my code needed to go when creating the service. I can't help much with what you are trying to do otherwise but thought this might help. http://www.c-sharpcorner.com/2/window_service.asp -- Israel
    0