博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java获取指定文件夹下的所有文件名
阅读量:4611 次
发布时间:2019-06-09

本文共 1050 字,大约阅读时间需要 3 分钟。

package com.henu.util;import java.io.File;public class TakeFilePathAndName {    public static void main(String[] args) {        // This is the path where the file's name you want to take.        String path = "C://Documents and Settings//yinxm//デスクトップ//TestFile";        getFile(path);    }    private static void getFile(String path) {        // get file list where the path has        File file = new File(path);        // get the folder list        File[] array = file.listFiles();        for (int i = 0; i < array.length; i++) {            if (array[i].isFile()) {                // only take file name                System.out.println("^^^^^" + array[i].getName());                // take file path and name                System.out.println("#####" + array[i]);                // take file path and name                System.out.println("*****" + array[i].getPath());            } else if (array[i].isDirectory()) {                getFile(array[i].getPath());            }        }    }}

 

转载于:https://www.cnblogs.com/henuyuxiang/p/7485927.html

你可能感兴趣的文章
2018 CCPC 秦皇岛 I (状压DP)
查看>>
mysql slave节点多线程复制
查看>>
一个挖矿脚本
查看>>
解析mysql慢日志
查看>>
VS2013调试技巧
查看>>
BZOJ4177Mike的农场——最小割
查看>>
JavaScript document属性和方法
查看>>
[转]利用Docker构建开发环境
查看>>
高斯 到 正态分布 的前世今生
查看>>
spark的外排:AppendOnlyMap与ExternalAppendOnlyMap
查看>>
Java虚拟机9:Java类加载机制
查看>>
Java正则表达式入门
查看>>
快速创建显示数字数据的动画——CountUp.js
查看>>
数据库备份脚本
查看>>
ubuntu 12.04 mysql转移目录后 无法 启动
查看>>
spring随笔
查看>>
windows下mysql配置,my.ini配置文件
查看>>
基于Ruby的watir-webdriver自动化测试方案与实施(五)
查看>>
数30的小程序
查看>>
Tensorflow Cpu不支持AVX
查看>>