遍历所有文件夹下文件信息
public static void Scan(String path) {
File file = new File(path);
File[] files = file.listFiles();
String[] filenames = file.list();
if (filenames == null)
return;
for (int i = 0; i < filenames.length; i++) {
if (files[i].isFile()) {
// if (files[i].getName().endsWith("png"))//只获取带png结尾的文件
// list.add(files[i].getPath());//获取路径
// System.out.println(files[i].getName());
} else if (files[i].isDirectory()) {
if ("ruoyi".equals(files[i].getName())) {
String newFileName = files[i].getPath().replaceAll("test" , "jinyi");
System.out.println(newFileName);
File file1 = new File(newFileName);
boolean b = files[i].renameTo(file1);
System.out.println(files[i].getName() + " ____ " + files[i].getPath());
} else {
Scan(files[i].getPath());
}
}
}
}
<el-table :cell-class-name="tableCellClassName" :data="commsgData" border height="300" ref="multipleTable"
@cell-click="cellClick" @cell-dblclick="cellDblclick">
<el-table-column
show-overflow-tooltip
type="selection"
width="55">
</el-table-column>
<el-table-column
show-overflow-tooltip
prop="name"
label="Name"
min-width="140"
sortable
>
<template slot-scope="scope">
<el-input v-show="scope.column.show " v-model="scope.row.name"></el-input>
</template>
</el-table>
tableCellClassName ({row, column, rowIndex, columnIndex}) {
// 注意这里是解构
// 利用单元格的 className 的回调方法,给行列索引赋值
row.index = rowIndex
column.index = columnIndex
},
cellClick (row, column, cell, event) {
column.show = true
this.$set(this.commsgData, row.index, row)
},
cellDblclick (row, column, cell, event) {
column.show = false
this.$set(this.commsgData, row.index, row)
}