简体   繁体   English

列出JAVA远程计算机上目录中特定类型的所有文件

[英]List all files of a particular type inside a directory on a remote machine in JAVA

I am trying to find a list of all zip files in a directory which is found by a path like: 我试图在目录中找到所有zip文件的列表,该目录可以通过以下路径找到:

https://abdc.defg.com/ijk/lmn/opq

If it was in a local filesystem, then the java.io.File's list() is does the job perfectly. 如果它在本地文件系统中,那么java.io.File的list()可以完美地完成工作。 But since this directory is on a remote machine in a foreign domain, java.io.File does not work. 但是由于该目录位于外部域中的远程计算机上,所以java.io.File不起作用。 Even 甚至

File dir = new File("https://abdc.defg.com/ijk/lmn/opq");

does not work. 不起作用。 I need a functionality just like java.io.File, and it would be best that I have to do this in Java's Standard APIs itself. 我需要像java.io.File一样的功能,最好是我必须在Java的标准API本身中执行此操作。 Please suggest a way to do this like on a local file system: 请提出一种在本地文件系统上执行此操作的方法:

File dir = new File("https://abdc.defg.com/ijk/lmn/opq");
File[] allFiles = dir.list();

抱歉,除了服务器为该功能提供某种服务外,无法使用http(s)进行此操作,例如,索引页列出目录中的所有文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM