Archived Forum Post

Index of archived forum posts

Question:

sftp wildcard in Cocoa

Aug 23 '12 at 04:59

Hi Everyone,

Is there any kind of wildcard when downloading using sftp. Something like that:

BOOL success = [sftp DownloadFileByName:@"/home/user/*.txt" localFilePath:@"/mydir"];

Thanks!


Answer

I'm sorry to say that using a wildcard like you've described will not work.

To download all files matching a pattern such as "*.txt", you would write code that iterates over the files in a directory, such as shown here: http://www.example-code.com/objc/sftp_readDir.asp

and then within the loop, call DownloadFileByName for each filename that matches your pattern.