effective rename for default action
This commit is contained in:
parent
74ffae4a31
commit
70b86ff4bd
|
@ -31,6 +31,7 @@ parseArguments()
|
||||||
|
|
||||||
function renameFile (originalFileName, fileMixedNewName) {
|
function renameFile (originalFileName, fileMixedNewName) {
|
||||||
fs.rename(originalFileName, fileMixedNewName, function (err) {
|
fs.rename(originalFileName, fileMixedNewName, function (err) {
|
||||||
|
console.log('name changed', fileMixedNewName)
|
||||||
if (err) console.log('rename ERROR: ' + err)
|
if (err) console.log('rename ERROR: ' + err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -64,6 +65,12 @@ function shouldWeChangeName (structureForFile) {
|
||||||
console.log('\n ancien nom :', structureForFile.fileNameOriginal)
|
console.log('\n ancien nom :', structureForFile.fileNameOriginal)
|
||||||
// console.log(' nouveau nom:', foundDate +structureForFile.freeText + structureForFile.tags.join(tagSeparator) + structureForFile.extension )
|
// console.log(' nouveau nom:', foundDate +structureForFile.freeText + structureForFile.tags.join(tagSeparator) + structureForFile.extension )
|
||||||
console.log(' nouveau nom:', newName)
|
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 {
|
} else {
|
||||||
console.log(' rien à changer')
|
console.log(' rien à changer')
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "sorting utilities and file tagging using PIM methodology of Karl Voit",
|
"description": "sorting utilities and file tagging using PIM methodology of Karl Voit",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodemon index.mjs testFiles/2sqdf45s5g456ghdf.jpg",
|
"start": "node index.mjs",
|
||||||
"devine": "node index.mjs",
|
"devine": "node index.mjs",
|
||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
|
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.7 MiB |
|
@ -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) {
|
function TestDownloadedTelegramPictureRename (fileName) {
|
||||||
let fileProperties = destructurateFileName(fileName)
|
let fileProperties = destructurateFileName(fileName)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue