View Single Post
Old Mar 31st, 2005, 11:31 PM   #8
thechristelegacy
Expert Programmer
 
thechristelegacy's Avatar
 
Join Date: Jul 2004
Location: Somerset, Pa
Posts: 707
Rep Power: 5 thechristelegacy is on a distinguished road
Send a message via AIM to thechristelegacy Send a message via MSN to thechristelegacy
Just because I was bored

from time import sleep
from os import chdir

# Keep this script in the same directory as the file you're wanting to copy
# to another location.

PATH_1 = "C:\home" #Change this to were where the first file is
PATH_2 = "C:\Anthonysstuff"  # Change this to whereever you're hosting the files to the internet
FILE_NAME = "traveller.txt" # Name of file


def update(sec):
    while 1:

        chdir(PATH_1)
        first = open(FILE_NAME,"r")
        x = first.read()
        first.close()
        # print len(x)

        chdir(PATH_2)
        second = open(FILE_NAME,"r")
        y = second.read()
        second.close()
        # print len(y)

        

        if len(x) > len(y):
            update = open(FILE_NAME,"w")
            update.write(x)
            update.close()
        else:
           sleep(sec) 

update(60) # The number is parentesies is how many seconds you want it to check

You'll need the Python runtime. Comments pretty much explain it, but if you have any questions, let me know.

Last edited by thechristelegacy; Mar 31st, 2005 at 11:33 PM.
thechristelegacy is offline   Reply With Quote