1.

Solve : saving a file every 30 seconds?

Answer»

I am experienced DOS user from back in the old days but have never had this type of problem so I hope someone can help or at least answer this for me.

We need to transfer a file of acquired data from one directory to another. The other directory is actually on another computer that is connected by radio, however, it is essentially networked through software in XP. We can copy the new file in DOS to the other computer but the problem is we need to do this automatically every 30 seconds. That is where my problem is.

Can you put a loop in a batch file or time an event like save a file in DOS?

We are looking at other methods like a backup PROGRAM in XP to backup a file or directory every 30 seconds. The data changes in these files and we need to constantly send it to the other computer in case or experiment crashes.

Thanks in advance for any suggestions or help

Dave Quote from: rmcel123 on May 06, 2009, 11:44:01 AM

...
Can you put a loop in a batch file or time an event like save a file in DOS?

Yes and yes.

With a goto statement you can make it loop.

http://www.vfrazee.com/ms-dos/6.22/help/goto.htm


To make it wait 30 seconds, one way is to USE a free third party utility program.
ftp://ftp.simtel.net/pub/simtelnet/msdos/batchutl/
and look for wait.zip


Quote
We are looking at other methods like a backup program in XP to backup a file or directory every 30 seconds. The data changes in these files and we need to constantly send it to the other computer in case or experiment crashes.

Syncback is very nice ( and there is a free version ) backup software.
You can read more about it, and download it here:
http://www.snapfiles.com/get/SyncBack.html
but I don't know if you could schedule it via Windows scheduler for every 30 seconds. Maybe the closest you could get would be once per minute?
Unless... you ran Syncback from the command line, and used wait.exe to make the batch file wait 30 seconds... .. it's an idea....

Quote
Thanks in advance for any suggestions or help

I hope this helps.

You can use, presuming you are running an NT family operating system, (Windows NT4, 2000, XP, 2003, Vista, etc) a utility called Sleep.exe which is part of the Microsoft Windows Server 2003 Resource Kit. This will suspend operation for either a specified number of seconds or milliseconds.

http://download.microsoft.com/download/8/e/c/8ec3a7d8-05b4-440a-a71e-ca3ee25fe057/rktools.exe

Code: [Select]
REM This is a "label"

:loop

REM do some stuff
REM wait 30 seconds
sleep 30
REM do some more stuff
REM goto next quits the loop
REM loop again
goto loop

:next

what about:
Code: [Select]ping -n 1 -w 30000 1.1.1.1 >nul
or

Code: [Select]@echo off
setlocal enableextensions

:SETUP
set sec=0
set /a sec=%1
set cout=0

:LOOP
set time_1=%time:~-4,1%
:ADD
set time_2=%time:~-4,1%
if not %time_1%==%time_2% (goto COUNT)
goto ADD

:COUNT
set /a cout+=1
if %cout% equ %sec% (goto :EOF)
goto LOOP
goto :EOF

??

then he dont need any .exe


Thanks for the suggestions. We actually like Syncback and it works fine for our needs.....sort of.

We are communicating between 2 computers using 2.4Ghz radios that supposedly simulate a network when all is well. One is attached to a helium balloon and will travel up to 30kms before exploding and sending the payload back to earth. We need to transfer data while the unit is working in case we don't RECOVER the payload.We are having a few hiccups and need to get this set up properly before we tackle the automatic save stuff.

I also have tried robocopy which is a MS utility, basically a super xcopy command. We can do that in 1 minute saves which is fine.

Thanks again for all the help.

Dave


Discussion

No Comment Found