2
Reply

checking file on server

Steven

Steven

Feb 24 2012 8:35 AM
1.9k
hi ,

i am triing to create an application on a mobile device that checks a file on a server;
the file is located in a shared folder.

i would like to check if the modify date of the file is more recent than the file on the device itself.
if more recent the app would need to download the file to the scanner.

I was able to have the application check if the device has an IP and display it
but when ever i try to connect to the file i get an exception.

Can someone help me please?

I have already tried several ways but here is one that i tried recently (just to check if the file is reachable)
**************************************************************

try
{
        FileInfo finfo = new FileInfo(@\\servername\sharedfolder\file.DAT);
        if (finfo.Exists)
        {
                this.label1.Text += "\n" + finfo.CreationTime;
        }
        else
        {
                this.label1.Text += "\n" +"file does not exist";
        }
}
catch (System.Exception exep)
{ this.label1.Text += "\n" + exep.Message; }


**************************************************************

Answers (2)