Knowledge Base

Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).


FTPGETFILE, GETFILE, GETNEXTFILE, and GETSITEFILE are only detecting every other file in the directory

FTPGETFILE / GETFILE and GETSITEFILE / GETNEXTFILE (when used with the /next option) are designed to iterate over a static directory of files.

Modifying that directory by deleting or moving a file with each iteration breaks those commands' ability to keep track of which file is next in the list. The result is that it will appear as though Robo-FTP is only detecting every other file.

Solution

If you are using FTPGETFILE or GETFILE, then use the FTPGETREWIND or GETREWIND command to reset the file pointer with each iteration, like this:

:loop
FTPGETREWIND
FTPGETFILE "*" /oldest
IFERROR= $ERROR_NO_FILE_FOUND goto no_more_files
RCVFILE %sitefile /delete
GOTO loop
:no_more_files

If you are using GETSITEFILE or GETNEXTFILE then do not use the /next option, like this:

:loop
GETSITEFILE "*" /oldest
IFERROR= $ERROR_NO_FILE_FOUND goto no_more_files
RCVFILE %sitefile /delete
GOTO loop
:no_more_files

Article last updated: 2021-01-18

Tags: Robo-FTP, FTPGETFILE, GETSITEFILE, GETFILE, GETNEXTFILE