From 23acd1cd5987311103f81551c82858955f7c7b16 Mon Sep 17 00:00:00 2001 From: lichaojun Date: Tue, 1 Oct 2024 17:49:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8E=B7=E5=8F=96=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/index.js | 2 +- utils/index.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/config/index.js b/config/index.js index 42f68d1..5b28234 100644 --- a/config/index.js +++ b/config/index.js @@ -2,7 +2,7 @@ const config = { //基础公共配置 base: { // 指定要查找的目录 - directoryPath: 'C:/Users/Administrator/Desktop/test', + directoryPath: 'E:/商品资料汇总/商品资料(1051-1100)', /** * 图片文件夹路径 * 1. 配置文件中inputDir为空 diff --git a/utils/index.js b/utils/index.js index 0fd7fc6..a1baa00 100644 --- a/utils/index.js +++ b/utils/index.js @@ -15,6 +15,7 @@ const getInputDir = () => { // 获取该文件夹下最新创建的文件夹作为工作目录 const getLatestFolder = (directory) => { let currentInputDir = null; + let latestTime = 0; // 读取指定目录 fs.readdirSync(directory, { withFileTypes: true }).forEach((file) => { @@ -22,9 +23,7 @@ const getLatestFolder = (directory) => { const folderPath = path.join(directory, file.name); const stats = fs.statSync(folderPath); const creationTime = stats.birthtimeMs; // 获取创建时间 - // 找到最新创建的文件夹 - let latestTime = 0; if (creationTime > latestTime) { latestTime = creationTime; currentInputDir = folderPath;