DownloadFile, UploadFile and OnDirectoryList
Posted: Fri 20 Dec 2019 03:32
Hi all,
We need to download files in a listed directory. I have a couple of questions regarding the callback event OnDirectoryList of TScSFTPClient as well as the TScSFTPClient.DownloadFile, UploadFile methods
1) Is it a good practice to download every single file by calling the SFTPClient.DownloadFile in the callback OnDirectoryList or we should save all files into a list first. Then iterate through the file list and call the DownloadFile?
2) The FileInfo: TScSFTPFileInfo returned from the callback, is it always assigned? Am I correct to do the following to check whether the returned FileInfo it is a file:
[code] if not Assigned(FileInfo) or (FileInfo.Attributes.FileType <> ftFile) then begin
Exit;
end;[/code]
3) With the DownloadFile(Source) and UploadFile(Destination), which operating system path types should I pass in DOS(\Server\Doc\file.txt or UNIX(/Server/Doc/file.txt)? Or Does the components support both DOS and Unix path separators?
Thank you,
Tran
We need to download files in a listed directory. I have a couple of questions regarding the callback event OnDirectoryList of TScSFTPClient as well as the TScSFTPClient.DownloadFile, UploadFile methods
1) Is it a good practice to download every single file by calling the SFTPClient.DownloadFile in the callback OnDirectoryList or we should save all files into a list first. Then iterate through the file list and call the DownloadFile?
2) The FileInfo: TScSFTPFileInfo returned from the callback, is it always assigned? Am I correct to do the following to check whether the returned FileInfo it is a file:
[code] if not Assigned(FileInfo) or (FileInfo.Attributes.FileType <> ftFile) then begin
Exit;
end;[/code]
3) With the DownloadFile(Source) and UploadFile(Destination), which operating system path types should I pass in DOS(\Server\Doc\file.txt or UNIX(/Server/Doc/file.txt)? Or Does the components support both DOS and Unix path separators?
Thank you,
Tran