파일명 포맷에 접미사 기능 추가
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user