• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Compare 2 files and copy newest if required (Yes that old c drive chestnut!!)

Hi Guys

I hit a Security problem whilst running a exe from network, so I put my wee app on c drive.

Of course rolling out new stuff is pain...so wanted to write a loader for it.... so it loads checks date on myExe in cd drive then sees if there is new version at \\mynetworkpath\myExe. Then downloads this to c drive and brings programs in synch. Then launches myExe

So how do I do comparision???

cheers George
0
Geo123
Asked:
Geo123
  • 5
  • 4
  • 3
1 Solution
 
RonaldBiemansCommented:
something lik this

        Dim fi1 As New System.IO.FileInfo("yourfileincd")
        Dim fi2 As New System.IO.FileInfo("yourfilenetworkpath")
        If fi1.CreationTime < fi2.CreationTime Then
            'whatever
        End If
0
 
Geo123Author Commented:
Whats the equivilent for VB6's "App.Path" in .Net??

How do I copy files?? I suspect security may kick in again... but nothing verntured.....

cheers George
0
 
S-TwilleyCommented:
fi1.CopyTo(newDestination)     ' or fi2.CopyTo ....

and

Application.ExecutablePath

===================

think those are probably the easiest to use in your case
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
S-TwilleyCommented:
If you don't want to move the FileInfo related files... use

IO.File.Copy("C:\File1.txt", "D:\File1.txt")

(or one of the many other ways)
0
 
Geo123Author Commented:
ok used the Application.StartupPath to cheat a wee bit as loader will be diff name. It copied the file down no bother.

1 last bit though... how do I launch the proper .net exe??? And close this loader down??

Thanks guys thats me nearly got this finished.... How am I going to split points though???

cheers

George
0
 
S-TwilleyCommented:
To start/load a file...

        Dim p As New Process
        p.StartInfo.FileName = myFullAppPath  ' myFullAppPath is your proper .net exe... so replace it accordingly
        p.Start()

=================

If your current program was loaded straight into a form, this should close it up.
        Me.Close

If it was started in another way, let me know.

As for splitting the points... give Ronald a bigger share since he answered your original question
0
 
Geo123Author Commented:
ok thats great... program working away merily... thanks for help guys

S-Twilley will put up another question and if you could answer that...wee thing... you dont have to answer and will still give u points... just dont know how to split points

cheers George
0
 
RonaldBiemansCommented:
To split points on the bottom of the page there should a button splits point :-)
0
 
Geo123Author Commented:
nope there wasnt Ronald...unless I am at wrong page!!
0
 
RonaldBiemansCommented:
There should be a spilt points somewhere on this page :-)
0
 
S-TwilleyCommented:
Just above where you type in a post (i.e. the box im typing in now, you should see some links like this):


    Split Points  
    Question Bookmark: Add  
    Post a Comment: (Question and Answer tips)

but they'll only be their while the question is open (so it's too late for this one)
 
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now