;; connect and change directory into source folder FTPLOGON 'www.example.com' /servertype=HTTP FTPCD "images" ;; get HTML listing into sitelist.txt FTPLIST IFERROR GOTO done ;; reset the file pointer by calling READFILE with no arguments READFILE :loop READFILE 'sitelist.txt' row /record=next IFERROR GOTO done ;; How many times does href=" appear on this line? SETSUBSTR chunks = row 'href="' IFNUM!= chunks 1 GOTO loop ;; Get filename out of the second half of the line SETEXTRACT chunk = row 'href="' 2 SETEXTRACT url = chunk '"' 1 ;; Don't download if last character is slash (folder not file) SETRIGHT last = url 1 IFSTRCMP last '/' GOTO loop ;; Download now RCVFILE url GOTO loop :done FTPLOGOFF DELETE 'sitelist.txt'