파일명 포맷에 접미사 기능 추가

This commit is contained in:
2026-05-22 10:27:59 +09:00
parent 77bc2815a3
commit bb5fd0a0e9
5 changed files with 9 additions and 15 deletions
+1 -2
View File
@@ -95,7 +95,6 @@ function register() {
ipcMain.handle('rename-files', async (_event, { folderPath, files, prefix, digits, postfix = '' }) => {
const errors = [];
const pad = (n) => String(n + 1).padStart(digits, '0');
const suffix = postfix ? `_${postfix}` : '';
// 1단계: 임시 이름으로 이동 (충돌 방지)
const tmpMap = [];
@@ -114,7 +113,7 @@ function register() {
// 2단계: 최종 이름으로 이동
const renamed = [];
for (const { tmp, ext, idx } of tmpMap) {
const newName = `${prefix}_${pad(idx)}${suffix}${ext}`;
const newName = `${prefix}${pad(idx)}${postfix}${ext}`;
const dest = path.join(folderPath, newName);
try {
fs.renameSync(tmp, dest);