effective rename for default action

This commit is contained in:
Tykayn 2023-07-03 21:14:31 +02:00 committed by tykayn
parent 74ffae4a31
commit 70b86ff4bd
4 changed files with 24 additions and 1 deletions

View File

@ -31,6 +31,7 @@ parseArguments()
function renameFile (originalFileName, fileMixedNewName) {
fs.rename(originalFileName, fileMixedNewName, function (err) {
console.log('name changed', fileMixedNewName)
if (err) console.log('rename ERROR: ' + err)
})
}
@ -64,6 +65,12 @@ function shouldWeChangeName (structureForFile) {
console.log('\n ancien nom :', structureForFile.fileNameOriginal)
// console.log(' nouveau nom:', foundDate +structureForFile.freeText + structureForFile.tags.join(tagSeparator) + structureForFile.extension )
console.log(' nouveau nom:', newName)
if(! mini_arguments.dryRun){
renameFile(structureForFile.fullPath, structureForFile.folderPath + newName)
}
else{
console.log('no renaming for real, this is a dry run')
}
} else {
console.log(' rien à changer')
}

View File

@ -4,7 +4,7 @@
"description": "sorting utilities and file tagging using PIM methodology of Karl Voit",
"main": "index.mjs",
"scripts": {
"start": "nodemon index.mjs testFiles/2sqdf45s5g456ghdf.jpg",
"start": "node index.mjs",
"devine": "node index.mjs",
"test": "jest"
},

View File

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@ -8,6 +8,22 @@ import fs from 'node-fs'
---------------------------------------------------------------------
**/
function LogActionRun(){
// get file which contains logs
// add an entry
// persist log file
}
function ListActions(idOfAction){
// retrieve log of actions from file
}
function RevertAction(idOfAction){
// select action and run all renames in the other way
}
function RevertMultipleActionsUntil(idOfAction){
// select action and run all renames in the other way for each point in time
}
function TestDownloadedTelegramPictureRename (fileName) {
let fileProperties = destructurateFileName(fileName)
}