GEEK STUFF


HostMonster web hosting - 50 GB space 999 GB transfer Raw log files Counters CGI-BIN $4.95 per month

Unlimited Domains • Raw Stat Logs • Counters • CGI-BIN • $4.95 mo.
SIGN UP FOR HostMonster.COM NOW


4NT Code Samples - Page 1

DAILY FTP DOWNLOAD TO A DIFFERENT FOLDER EACH DAY.

This assumes that the FTP source directory does not change.
This does not create the target directory. It assumes that was done at the beginning of the year.
Tree format:
Drive:\
Drive:\YYYY\
Drive:\YYYY\YY-MM\
Drive:\YYYY\YY-MM\DD\

The target directory will be the same as the date the utility is run. If you run the routine at 2:00 A.M. local time on 8/6/04, and the source updates at 4:00 a.m., you will be downloading files dated 8/5/04 but storing them in the \04-08\06 subdirectory.


This requires 4NT from JP Software.

:   by Joseph "Rick" Reinckens
:   Please visit www.GodOnThe.Net
:
:   This requires 4NT from www.JPSoft.com
:   USE FTP TO COPY ALL FILES FROM A HOST'S /STATS SUBDIR TO A
:   LOCAL SUBDIR WHOSE NAME IS IN THE FORMAT D:\subdir\YYYY\YY-MM\DD
:   E.G., stats for 5/9/2004 go in D:\mystats\2004\04-05\09\

@echo off
color blue on bright white
cls

set yr=%@substr[%_isodate,2,2]
set mo=%@substr[%_isodate,5,2]
set dy=%@substr[%_isodate,8,2]

s:
cd\
cdd s:\Hubble\%_year\%yr-%mo\%dy\

:  ftp://  Username colon password @ domain name slash subdir (all in quotes)
iftp "ftp://UsrName:Password@hubblespacephotos.com/stats"

:  change s:\Hubble to where your data will be stored
copy /e "ftp:*.*" s:\Hubble\%_year\%yr-%mo\%dy\
iftp /c

unset yr
unset mo
unset dy

: Count number of files in subdir. 4NT can't do this directly.
dir/b >temp.txt

:  Remove colon at beginning of next line to find out
:  what number to put in the comparison below
:  echo %@lines[temp.txt]

:  If the number of files may change, delete the iff ... endiff section below 
iff %@lines[temp.txt]==36 then
: The box title goes in quotes. Text in the box does not get quotes.
  MSGBOX OK "STATS SAVED OKAY" HUBBLE STATS SAVED FOR %_monthf %_day, %_year
else
  MSGBOX /W OK "UH-OH!" PROBLEM SAVING HUBBLE STATS
endiff

delete temp.txt    


GOD ON THE NET

(c) 2006 Rick Reinckens