<< Back


FVSDK_MoveDown

Synopsis

FVSDK_ERROR_CODE FVSDK_MoveDown(FVSDK_Session* pSession, LPCTSTR pszSourcePath, LPCTSTR pszDestPath);

Description

Downloads one or more files from the connected server then deletes them from the server when the transfer is successful. If using wildcards, multiple files can be moved down into a single directory (pszDestPath). Use this function when you want to download a file or files, then delete, with a single function call. Use FVSDK_OpenFile() to download a single file in blocks, fully under your control.

When pSession->bConnectionSaver is TRUE (the default), this function waits (blocks) until the file transfer is complete. When pSession->bConnectionSaver is FALSE, this function returns prior to the transfer starting, making this function asynchronous (non-blocking).

Parameters

pSession

A pointer to the FVSDK_Session that is to perform the operation.

pszSourcePath

The remote path to a single file or the path to a directory with a wild carded name.

pszDestPath

The local path to a single file or a path where wild carded files are to be downloaded. If specifying a directory name for the destination, be sure to end the string with a \ character to signify a directory.

Return Value

FVSDK_OK if successful; error codes can be found in FVSDK_ErrorCodes.h.

NOTE: If the session structure is valid, this function always returns FVSDK_OK. This is done because transfers can be asynchronous if bConnectionSaver is set to FALSE. To be notified of transfer errors, use the appropriate callback function found in the FVSDK_Session structure.

Example

// turn off connection saver so the downloads are asynchronous (non-blocking)
pSession->bConnectionSaver = FALSE;

// apply the session changes
FVSDK_ApplySessionChange(pSession);

// NOTE: because we turned connection saver off (above) the following functions will exit
// prior to completing the transfer

// move the file down from the server (notice that the local filename can be different)
FVSDK_MoveDown(pSession, "/pub/rhinosoft/ftpvoyager/fvsetup.exe", "D:\\Temp\\ftpvoyager.exe");

// move the file down from the server
FVSDK_MoveDown(pSession, "/pub/rhinosoft/ftpvoyager/ftpvgerman.exe", "D:\\Temp\\");

// move all of the text files in the provided path down from the server
FVSDK_MoveDown(pSession, "/pub/rhinosoft/ftpvoyager/*.txt", "D:\\Temp\\");