Back to product page

LoopFiles function


Loops through multiple files in a sequence, recursive, giving their names.

Type

A Long value. If successful, 0 is returned, otherwise error as specified here

Syntax

  • C
long Sftp_LoopFiles(void *Sftp, char * RemotePath, int MaxLevel);
The LoopFiles(void *Sftp,char *RemotePath,int MaxLevel) syntax has these parts:
void *SftpHandle of the created Sftp instance.
char *RemotePathHolds full path on the server from where to start enumerating files and folders.
int MaxLevelSpecifies maximum number of subdirectory levels to access. 0 for unlimited.

Remarks

This function will just loop through all folders and files on specified RemotePath, and call LoopItem callback for each file/folder it finds - allowing you to save it (for example, in local collection) and then use later for various file/folder operations. wodSFTP will not do anything with those items by itself! Since LoopItem will provide full paths to those files, it is easy to use those paths later on with GetFile, GetData, PutFile, DeleteFile (etc.) operations.

If you want to download all those files (and create appropriate directory structure locally) you should use GetFiles function instead.

Do not forget that RemotePath should always specify full absolute path (i.e. /home/joe/something) instead of relative path (i.e. joe/something).

Platforms

Windows