gpt4 book ai didi

java - ls 过滤 channel ftp

转载 作者:行者123 更新时间:2023-11-30 04:27:16 25 4
gpt4 key购买 nike

有什么方法可以使用此 API 过滤要列出的文件吗?例如:

    ChannelSftp sftpChannel;
sftpChannel.ls(path);

这列出了所有内容,但我想过滤以 AAA 开头的文件

最佳答案

假设您使用 JSch ,您应该能够在 path 的最后部分使用全局字符(*?)。至少this unofficial JavaDoc提到这一点:

The pattern can contain glob pattern wildcards (* or ?) in the last component (i.e. after the last /).

所以尝试一下

sftpChannel.ls(path + '/AAA*');

关于java - ls 过滤 channel ftp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15548135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com