homepage Welcome to WebmasterWorld Guest from 54.166.65.9
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Deprecated - Microsoft Windows OS (XP/NT/Vista)
Forum Library, Charter, Moderators: bill

Deprecated - Microsoft Windows OS (XP/NT/Vista) Forum

    
looping dos command file, ftp upload
looping dos command file, ftp upload
drooh




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

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!

 

Frank_Rizzo




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

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.

drooh




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

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?

Frank_Rizzo




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

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)
[microsoft.com...]

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
:loop
PING -n 16 127.0.0.1>nul
if exist c:\pathtofile\currentsong.txt goto file_updated
goto loop
:file_updated
*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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Deprecated - Microsoft Windows OS (XP/NT/Vista)
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved