当前位置:网站首页>Go recursively loops through folders
Go recursively loops through folders
2022-04-23 19:21:00 【Handsome that handsome】
/** dirname Directory name level Hierarchy */
func listFiles(dirName string,level int) {
//level Used to record the current recursive hierarchy , Generate spaces with a sense of hierarchy
s :="|--"
for i:=0;i<level;i++ {
s = "| "+s
}
fileInfos,err := ioutil.ReadDir(dirName)
if err != nil {
log.Fatal(err)
}
for _,fi := range fileInfos{
filename := dirName+"/"+fi.Name()
fmt.Printf("%s%s\n",s,filename)
if fi.IsDir() {
// Recursive call method
listFiles(filename,level+1)
}
}
}
版权声明
本文为[Handsome that handsome]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210557451118.html
边栏推荐
- Some ideas about time-consuming needs assessment
- Openlayers 5.0 two centering methods
- Installation, use and problem summary of binlog2sql tool
- Oracle配置st_geometry
- binlog2sql 工具安装使用及问题汇总
- SSDB基础
- Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
- Why is PostgreSQL about to surpass SQL Server?
- js获取本机ip地址
- An algorithm problem was encountered during the interview_ Find the mirrored word pairs in the dictionary
猜你喜欢

Use of fluent custom fonts and pictures

Reflection on the performance of some OpenGL operations in the past

Network protocol: SCTP flow control transmission protocol
![[报告] Microsoft :Application of deep learning methods in speech enhancement](/img/29/2d2addd826359fdb0920e06ebedd29.png)
[报告] Microsoft :Application of deep learning methods in speech enhancement

Why is PostgreSQL about to surpass SQL Server?

深度学习——特征工程小总结

Application of DCT transform

The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch

Pdf reference learning notes

MySQL syntax collation (4)
随机推荐
openlayers 5.0 离散聚合点
binlog2sql 工具安装使用及问题汇总
Circuit on-line simulation
Summary of several relationships of UML class diagram
Transaction processing of SQL Server database
2022.04.23 (lc_763_divided into letter interval)
SSDB基础3
Openlayers 5.0 thermal diagram
Using Visual Studio code to develop Arduino
8266 obtain 18b20 temperature
Openlayers 5.0 two centering methods
Strange problems in FrameLayout view hierarchy
SQL server requires to query the information of all employees with surname 'Wang'
Matlab 2019 installation of deep learning toolbox model for googlenet network
[play with lighthouse] Tencent cloud lightweight server builds a full platform video analysis video download website
Web Security
Raspberry pie 18b20 temperature
优先使用组合而不使用继承
数据分析学习目录
Pdf reference learning notes