Closed jamoros closed 2 years ago
It does not work like that.
SFTP does not support wildcards. The stat call requires the path to a real file, if no file exists it will throw a SftpStatusException.
You can do a recursive get via SCP but that actually downloads the file, not just lists them. I'm not sure how OpenSSH's recent announcement about moving SCP to SFTP affects this.
Ok, thank you! I added the code for the little work around and its worked so far except for yet another issue I'm dealing with.
Cheers!
Greetings again!
I am currently running into an issue where I'd like to get information about a file or set of files where the file path has a wildcard. For example I tried the following:
SftpFileAttributes sftpFileAttribute = stat("/home/user/MyFile_2022_06_01*.csv");
In the directory I have a file
/home/user/MyFile_2022_06_01_Daily.csv
I expect that file to be returned in the attributes but I am getting no file found.
Is there an alternative way to do this or am I doing something wrong with the above? Im aware that
stat
returns attributes of a file or a directory, but I'd like to get something working using the wildcard.As always, any information is greatly appreciated!
EDIT
I wrote a work around, but I wonder if there's a more efficient way to do this: