VS 2010 [RESOLVED] IDEAS NEEDED: Copying a file to many remote computers-VBForums
Results 1 to 12 of 12

Thread: [RESOLVED] IDEAS NEEDED: Copying a file to many remote computers

  1. #1

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Resolved [RESOLVED] IDEAS NEEDED: Copying a file to many remote computers

    OK, I have to periodically (2-3x/wk) copy a file or two to approximately 70 remote computers. I have full control of the remote computers and they all follow the same directory structure and security permissions. I have asked in the General PC forum to see if anybody had any ideas, but I think I might just develop my own solution.

    I need to accomplish the following:
    • Determine if the file is in use, if it is - Kill it
    • Rename the current file (perhaps the extension to the date ex. 20110720 for 7/20/11)
    • Copy over the new file
    • Receive confirmations/errors for each remote location


    The program will only need to be installed on two computers who will have this ability. I am thinking I could easily keep a database table of the remote locations and just loop through the records in order to get the destination. My concern is whether or not I should use My.Computer.CopyFile to accomplish the remote copying. Is there a better class that you know of?

    Do you have a better idea? Am I re-inventing the wheel? Do you know a program that does this already? Any ideas are much appreciated.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  2. #2
    Addicted Member Smartacus's Avatar
    Join Date
    Oct 2009
    Location
    Deep South, USA
    Posts
    196

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Can you give us an idea of the file's function? A logon script could help keep the file update when the user logs on and a single source location is kept with the file to copy.
    ***************************************************
    Smartacus comes packaged "As Is With No Warranty"

    ************* Useful Links ******************
    FAQs: Index / Database Development / .NET CodeBank /
    Before Posting Here...MSDN

    MZTools (I love this tool when using VB6 - Free) /

  3. #3

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by Smartacus View Post
    Can you give us an idea of the file's function? A logon script could help keep the file update when the user logs on and a single source location is kept with the file to copy.
    File is part of a larger Access database. We add new rows to the tables and have to update the locations so they know how to process the new items. These remote locations are not part of a domain in any way. They don't even logon at all - AutoLogon is set in the registry.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  4. #4
    Hyperactive Member
    Join Date
    May 2009
    Posts
    274

    Re: IDEAS NEEDED: Copying a file to many remote computers

    On the client machines have a downloader that contacts your server, downloads the file then compare's the modified date of the one it has just downloaded against the one currently residing on the system. If the downloaded has a newer date delete the current one and replace else ignore the downloaded one

    EDIT: It'd be much easier for the clients to download from YOUR location rather than you trying to maintain their locations and add new locations everytime someone joins you 'circle' etc etc
    Last edited by norman_bates; Jul 20th, 2011 at 11:37 AM. Reason: Added a little bit

  5. #5

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by norman_bates View Post
    On the client machines have a downloader that contacts your server, downloads the file then compare's the modified date of the one it has just downloaded against the one currently residing on the system. If the downloaded has a newer date delete the current one and replace else ignore the downloaded one

    EDIT: It'd be much easier for the clients to download from YOUR location rather than you trying to maintain their locations and add new locations everytime someone joins you 'circle' etc etc
    This would mean 70 program installs instead of 2. Additionally, it would involve creating more network traffic to check the server at whichever interval I choose.

    I am not worried about the locations (they don't change - fixed buildings). To add a new location, I would just add a new row like: Store#, StoreIP.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,291

    Re: IDEAS NEEDED: Copying a file to many remote computers

    This is how I'd do:
    1. Have a list of all the remote computers and directory on which you want to upload the new file to.
    2. Loop thru the remote computer list
    Try to rename the current file on this computer.
    If failed (the file is in use), kill the process that uses it. Use SysInternal's PsKill tool for this. Then try to rename it again. Possibly loop until successfully rename that file or reach a loop limit. If loop limit reaches, write to log (so that you know which remote computer did have the new file... Manually copy it later?)
    If rename successfully, copy the new file to the remote computer.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  7. #7

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by stanav View Post
    This is how I'd do:
    1. Have a list of all the remote computers and directory on which you want to upload the new file to.
    2. Loop thru the remote computer list
    Try to rename the current file on this computer.
    If failed (the file is in use), kill the process that uses it. Use SysInternal's PsKill tool for this. Then try to rename it again. Possibly loop until successfully rename that file or reach a loop limit. If loop limit reaches, write to log (so that you know which remote computer did have the new file... Manually copy it later?)
    If rename successfully, copy the new file to the remote computer.
    Agreed...and it was pretty much my thinking. Do you think using My.Computer.CopyFile will work good enough or should I use IO.FileSystem class? Any other classes out there you can think of that might be better?
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  8. #8
    Addicted Member Smartacus's Avatar
    Join Date
    Oct 2009
    Location
    Deep South, USA
    Posts
    196

    Re: IDEAS NEEDED: Copying a file to many remote computers

    So these are ADP programs?
    ***************************************************
    Smartacus comes packaged "As Is With No Warranty"

    ************* Useful Links ******************
    FAQs: Index / Database Development / .NET CodeBank /
    Before Posting Here...MSDN

    MZTools (I love this tool when using VB6 - Free) /

  9. #9
    Addicted Member Smartacus's Avatar
    Join Date
    Oct 2009
    Location
    Deep South, USA
    Posts
    196

    Re: IDEAS NEEDED: Copying a file to many remote computers

    stanav - So glad you logged in today. I am starting a new thread on a piece of code you published a few years ago. Serial Port reading. I would appreciate your input since you are directly familiar with it.
    ***************************************************
    Smartacus comes packaged "As Is With No Warranty"

    ************* Useful Links ******************
    FAQs: Index / Database Development / .NET CodeBank /
    Before Posting Here...MSDN

    MZTools (I love this tool when using VB6 - Free) /

  10. #10
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,291

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by mbutler755 View Post
    Agreed...and it was pretty much my thinking. Do you think using My.Computer.CopyFile will work good enough or should I use IO.FileSystem class? Any other classes out there you can think of that might be better?
    Both methods should work equally well. However, I prefer to use the system.io.file class because it's a direct conversion should the program later need to be converted to C# ... As a precaution, always use UNC path and IP address whenever possible. Avoid using mapped path... I've had incidents where DNS would resolve a name to wrong IP address (the DNS server didn't update DNS data in time and thus the result wasn't correct), and that's why I suggest to use IP address instead of DNS names.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  11. #11

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by Smartacus View Post
    So these are ADP programs?
    Access Database Programs? - Yes

    But they are made up of multiple files.
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

  12. #12

    Thread Starter
    Hyperactive Member mbutler755's Avatar
    Join Date
    May 2008
    Location
    Peoria, AZ
    Posts
    417

    Re: IDEAS NEEDED: Copying a file to many remote computers

    Quote Originally Posted by stanav View Post
    Both methods should work equally well. However, I prefer to use the system.io.file class because it's a direct conversion should the program later need to be converted to C# ... As a precaution, always use UNC path and IP address whenever possible. Avoid using mapped path... I've had incidents where DNS would resolve a name to wrong IP address (the DNS server didn't update DNS data in time and thus the result wasn't correct), and that's why I suggest to use IP address instead of DNS names.
    Our DNS is the same way, I would only use IPs. Thanks for the suggestion on IO.File
    Regards,

    Matt Butler, MBA, BSIT/SE, MCBP
    Owner, Intense IT, LLC
    Find us on Facebook
    Follow us on Twitter
    Link up on LinkedIn
    mb (at) i2t.us

    CODE BANK SUBMISSIONS: Converting Images to Base64 and Back Again

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.