当前位置:网站首页>Recursively traverse directory structure and tree presentation
Recursively traverse directory structure and tree presentation
2022-06-26 05:15:00 【Light ink CGZ】
code snippet , Note the code example address . Is custom .
import java.io.File;
public class TestFile6 {
public static void main(String[] args) {
File f = new File("d:/ The movie ");
printFile(f, 0);
}
/** * Print file information * @param file File name * @param level Number of layers ( The actual is : The number of recursive calls ) */
static void printFile(File file, int level) {
// Number of output layers
for (int i = 0; i < level; i++) {
System.out.print("-");
}
// Output file name
System.out.println(file.getName());
// If file Is a directory , Then get the sub file list , And do the same operation for each sub file
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File temp : files) {
// Call the method recursively : Pay attention to wait +1
printFile(temp, level + 1);
}
}
}
}


边栏推荐
- Apktool tool usage document
- The best Chinese open source class of vision transformer, ten hours of on-site coding to play with the popular model of Vit!
- Modify the case of the string title(), upper(), lower()
- Pytorch forecast house price
- ModuleNotFoundError: No module named ‘numpy‘
- cartographer_ fast_ correlative_ scan_ matcher_ 2D branch and bound rough matching
- 《财富自由之路》读书之一点体会
- The first gift of the project, the flying oar contract!
- Windows下安装Tp6.0框架,图文。Thinkphp6.0安装教程
- Classic theory: detailed explanation of three handshakes and four waves of TCP protocol
猜你喜欢

cartographer_optimization_problem_2d

Codeforces Round #802 (Div. 2)(A-D)
Briefly describe the pitfalls of mobile IM development: architecture design, communication protocol and client
Why does the mobile IM based on TCP still need to keep the heartbeat alive?

【Unity3D】人机交互Input

pycharm 导包错误没有警告

【活动推荐】云原生、产业互联网、低代码、Web3、元宇宙……哪个是 2022 年架构热点?...

cartographer_ optimization_ problem_ 2d

cartographer_ local_ trajectory_ builder_ 2d

递归遍历目录结构和树状展现
随机推荐
Introduction to classification data cotegory and properties and methods of common APIs
Cookie and session Basics
【红队】要想加入红队,需要做好哪些准备?
RESNET in tensorflow_ Train actual combat
Briefly describe the pitfalls of mobile IM development: architecture design, communication protocol and client
Technical past: tcp/ip protocol that has changed the world (precious pictures, caution for mobile phones)
Guanghetong and anti international bring 5g R16 powerful performance to the AI edge computing platform based on NVIDIA Jetson Xavier nx
As promised: Mars, the mobile terminal IM network layer cross platform component library used by wechat, has been officially open source
[latex] error type summary (hold the change)
[ide (imagebed)]picgo+typora+aliyunoss deployment blog Gallery (2022.6)
Douban top250
Status of processes and communication between processes
Serious hazard warning! Log4j execution vulnerability is exposed!
5. <tag-栈和常规问题>补充: lt.946. 验证栈序列(同剑指 Offer 31. 栈的压入、弹出序列)
[geek] product manager training camp
Gd32f3x0 official PWM drive has a small positive bandwidth (inaccurate timing)
Pycharm package import error without warning
Using requests library and re library to crawl web pages
两步处理字符串正则匹配得到JSON列表
关于支付接口回调地址参数字段是“notify_url”,签名过后的特殊字符url编码以后再解码后出现错误(¬ , ¢, ¤, £)