Google Answers Logo
View Question
 
Q: Batch file: ping home network PCs and copy files when connected PC detected ( No Answer,   5 Comments )
Question  
Subject: Batch file: ping home network PCs and copy files when connected PC detected
Category: Computers
Asked by: jacksonmarbach-ga
List Price: $5.00
Posted: 30 Sep 2003 04:26 PDT
Expires: 30 Oct 2003 03:26 PST
Question ID: 261485
I run a regular backup that produces zipped and encrypted backup
files. What I want to do is send them over my home wireless network to
the PC downstairs that has the CD writer on it so I can then go down
and copy them onto CD.

The trouble is, I'm too lazy to go downstairs, switch on, come up,
send files, go down, copy CD, and come back up. What I'd like to do is
have a batch
file that makes my upstairs computer detect when the downstairs one
switches on and connects to the network (I know its IP number, and I
know from setting up my firewall software that when each computer
switches on it sends out pings)and then sends over the files using a
simple Dos copy or move command.

Of course I'd want to decide a scanning frequency (eg once every 10 or
30 minutes) and I'd want the program to ensure that once it has sent
the files, it stops, and doesn't keep pinging away forever.

I realize that you can put a ping command in a batch file. What I
don't know is how to write a batch file that will run a command every
x minutes until something happens, and nor do I know how to write a
batch file if-statement that will carry out the file move/copy
instruction only if the downstairs PC is connected, and then stop.
Answer  
There is no answer at this time.

Comments  
Subject: Re: Batch file: ping home network PCs and copy files when connected PC detected
From: gw-ga on 30 Sep 2003 06:11 PDT
 
@echo off

:loop

rem insert delay here (search for sleep.com utility)

ping 192.168.1.1 -n 1|find "Request timed out."

if not errorlevel 1 goto loop

echo begin copying files here...

pause
Subject: Re: Batch file: ping home network PCs and copy files when connected PC detected
From: jacksonmarbach-ga on 07 Oct 2003 02:26 PDT
 
Thanks, gw-ga.  I'm going to check it out.

Assuming it works, I owe you five bucks. I haven't worked out how to
pay someone if they proposed their answer as a comment instead of an
answer. Can you please either tell me how to pay a comment, or refile
your comment as an answer?

Thanks.
Subject: Re: Batch file: ping home network PCs and copy files when connected PC detected
From: jacksonmarbach-ga on 08 Oct 2003 08:10 PDT
 
Hello again, gw-ga.

I'm sorry to be a dummy but a complication has come up. My network
uses DHCP. This means that the IP number of the machine I want to send
the information to changes according to when it logged on to the
network.

Can we amend the batch file so that it finds the IP number of the
machine from the network itself, using the remote machine's name?
Subject: Re: Batch file: ping home network PCs and copy files when connected PC detected
From: sdickson-ga on 09 Oct 2003 15:38 PDT
 
You have a few choices:

1) Either set your DHCP server (I'm guessing it's on a DSL/Cable
router or a Windows 98 machine) to be disabled, then set all your
machines to have static IPs

OR

2) (If possible) Set your DHCP server tombstoning timeout to be a
greater amount, something like a few days. That way, your DHCP lease
won't get timed out in the server, even if the machine is off for a
few days. FYI, Windows 2000 server by default has a lease of 7 days
when DHCP server is first installed on it (just as a suggestion of how
one type is set).

If you can't change tombstoning, try changing the lease length to a
longer time.

OR

3) change the ping line to read something like the following:

ping machinename -n 1|find "Request timed out." 

The problem with this one is that your machine keeps a cache called
the ARP cache of what names go to what machine. This list SHOULD be
updated frequently, but it is entirely possible that your machine will
remember the old IP address and try pinging that, instead of the new
one.

-------------------------------------------------
As far as switching a comment to an answer:
Can't. Google stopped accepting Researchers over a year ago. So, the
only way those of us who want to become researchers can help out is to
do comments.

My suggestion is to get ahold of gw-ga and see if an electronic
transfer service, similar to Paypal, can be used. Granted, there will
be a small percentage lost as part of Paypal's processing fee, but
it's better than nothing.
Subject: Re: Batch file: ping home network PCs and copy files when connected PC detected
From: ntfsdotorg-ga on 18 Oct 2003 03:11 PDT
 
Maybe just use "my Briefcase" simple and effective.

http://www.winplanet.com/winplanet/tutorials/1074/1/

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy