Welcome to WebmasterWorld Guest from

Forum Moderators: bill

Message Too Old, No Replies

looping dos command file, ftp upload

looping dos command file, ftp upload



8:30 pm on Sep 18, 2007 (gmt 0)

5+ Year Member

I need something to keep uploading a file over and over, or monitor when the file changes to then upload it.

Im running and internet radio station. There is a currentsong.txt file that is generated after each track change.

Right now I have a dos command that uploads the file every 1 minute, however I need it to upload more oftne then that. Is there a way to make a dos command loop over and over or is there a way to monitor the file for changers and then upload it when it changes? If anything the looping dos command would work (although several unessary uploads) or a program that fires off that dos command every 10 or 15 seconds would be great. Thanks!


8:50 pm on Sep 18, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

What generates the currentsong.txt file?

Whatever app generates that file should then initiate the ftp upload either by doing it itself or calling a batch file.


3:34 am on Sep 19, 2007 (gmt 0)

5+ Year Member

the program is zararadio. there is a program called zaraftp that runs alongside it, but it is not reliable...thus why I am exploring other options.

zararadio seems to be able to load and execute .bat files however they for whatever reason do not seem to work...

so again, is there any way to schedule a system command every 10-15 seconds or loop a dos command, possibly w/ a slight delay in the dos command?


10:06 am on Sep 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

The neatest way would be to test the archive bit of the currentsong.txt file. If the attribute is set then the file has changed so ftp...

I can't find how to do that so here is a quick solution based on if the file exists.

1. wait 15 seconds
2. check if file exists
3. If yes ftp the file and then move the file (rename to something else)
4. goto 1

The main problem here now is the wait 15 seconds bit as there is no direct command in XP / DOS to do this. You will either have to:

download Windows Server 2003 Resource Kit tools (30Mb download just for one tiny app)

use a third party utils suite (may not be free)

Try a hack using ping. For this example I'll use the ping hack.

@echo off
PING -n 16>nul
if exist c:\pathtofile\currentsong.txt goto file_updated
goto loop
*ftp -b .... your ftp line here
move /Y c:\pathtofile\currentsong.txt c:\pathtofile\lastsong.txt
goto loop

BTW, I would recommend downloading psftp from putty. This is a secure ftp which has better ftp batch processing commands. You would need to ensure that your server accepts ssh ports first.


Featured Threads

Hot Threads This Week

Hot Threads This Month