|
@@ -85,6 +85,19 @@ function isImageFile(fileName) {
|
|
|
|
|
|
//读取文件,返回网站路径. 只扫描当前文件夹,不递归扫描
|
|
|
function readImageFiles(folderPath) {
|
|
|
+ try {
|
|
|
+ const filesToRename = fs.readdirSync(folderPath);
|
|
|
+ filesToRename
|
|
|
+ .filter(isImageFile)
|
|
|
+ .forEach(fileName =>
|
|
|
+ fs.renameSync(
|
|
|
+ folderPath + "/" + fileName,
|
|
|
+ folderPath + "/" + fileName.toUpperCase()
|
|
|
+ )
|
|
|
+ );
|
|
|
+ } catch (e) {
|
|
|
+ alert("将身份证号转为大写出错。");
|
|
|
+ }
|
|
|
const files = fs.readdirSync(folderPath);
|
|
|
return files
|
|
|
.filter(isImageFile)
|