-
Jul 20th, 2011, 09:46 AM
#1
Thread Starter
Hyperactive Member
[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.
-
Jul 20th, 2011, 10:02 AM
#2
Addicted Member
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.
-
Jul 20th, 2011, 11:08 AM
#3
Thread Starter
Hyperactive Member
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by Smartacus
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.
-
Jul 20th, 2011, 11:35 AM
#4
Hyperactive Member
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
-
Jul 20th, 2011, 11:58 AM
#5
Thread Starter
Hyperactive Member
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by norman_bates
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.
-
Jul 20th, 2011, 12:47 PM
#6
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 -
-
Jul 20th, 2011, 01:08 PM
#7
Thread Starter
Hyperactive Member
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by stanav
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?
-
Jul 20th, 2011, 01:11 PM
#8
Addicted Member
Re: IDEAS NEEDED: Copying a file to many remote computers
So these are ADP programs?
-
Jul 20th, 2011, 01:14 PM
#9
Addicted Member
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.
-
Jul 20th, 2011, 01:26 PM
#10
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by mbutler755
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 -
-
Jul 20th, 2011, 02:38 PM
#11
Thread Starter
Hyperactive Member
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by Smartacus
So these are ADP programs?
Access Database Programs? - Yes
But they are made up of multiple files.
-
Jul 20th, 2011, 02:39 PM
#12
Thread Starter
Hyperactive Member
Re: IDEAS NEEDED: Copying a file to many remote computers
Originally Posted by stanav
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|