From 9442153b328c29ebe40b49ad5437d64f70eae963 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sat, 29 Jul 2023 16:52:53 +0200 Subject: [PATCH] up deps folder listing node --- folder-listing-node/index.mjs | 62 ++++++++++++++++++++--------------- package-lock.json | 14 ++++++++ package.json | 2 ++ rangement/.idea/.gitignore | 8 +++++ rangement/.idea/misc.xml | 6 ++++ rangement/.idea/modules.xml | 8 +++++ rangement/.idea/rangement.iml | 8 +++++ rangement/.idea/vcs.xml | 6 ++++ 8 files changed, 87 insertions(+), 27 deletions(-) create mode 100644 rangement/.idea/.gitignore create mode 100644 rangement/.idea/misc.xml create mode 100644 rangement/.idea/modules.xml create mode 100644 rangement/.idea/rangement.iml create mode 100644 rangement/.idea/vcs.xml diff --git a/folder-listing-node/index.mjs b/folder-listing-node/index.mjs index 6b625940..ef0b0296 100644 --- a/folder-listing-node/index.mjs +++ b/folder-listing-node/index.mjs @@ -1,48 +1,56 @@ // lister les dossiers dans le dossier stockage syncable pour en tirer une liste de dates d'évènements -import fs from 'fs'; +import fs from 'fs' let suffix = '' -const folder_photo = `/home/poule/encrypted/stockage-syncable/photos${suffix}`; +const folder_photo = `/home/poule/encrypted/stockage-syncable/photos${suffix}` /** * obtenir une liste des dossiers uniquement dans le dossier courant * @param path * @returns {*} */ -function getDirectories(path) { - return fs.readdirSync(path).filter(function (file) { - return fs.statSync(path + '/' + file).isDirectory(); - }); +function getDirectories (path) { + return fs.readdirSync(path).filter(function (file) { + return fs.statSync(path + '/' + file).isDirectory() + }) } /** * lister 3 sous niveaux de dossiers * @param folders */ -function recursiveListing(folders){ +function recursiveListing (folders) { - for (let dossier of folders) { + for (let dossier of folders) { - dossier = dossier.trim() - console.log(folder_photo + '/' + dossier) - let subdir1 = folder_photo + '/' + dossier - let listing = getDirectories(subdir1) - if (listing.length) { - // console.log('', listing) - for (let d2 of listing) { - let subdir2 = folder_photo + '/' + dossier+'/'+d2 - console.log(subdir2) - let listing2 = getDirectories(subdir1) - if (listing2.length) { - for (let d3 of listing2) { - let subdir3 = subdir2 +'/'+d3 - console.log(subdir3) - } - } + dossier = dossier.trim() + console.log(folder_photo + '/' + dossier) + let subdir1 = folder_photo + '/' + dossier + let listing = getDirectories(subdir1) + if (listing.length) { + // console.log('', listing) + for (let d2 of listing) { + let subdir2 = folder_photo + '/' + dossier + '/' + d2 + console.log(subdir2) + let listing2 = getDirectories(subdir1) + if (listing2.length) { + for (let d3 of listing2) { + let subdir3 = subdir2 + '/' + d3 + console.log(subdir3) - } - } - } + let listing3 = getDirectories(subdir2) + if (listing3.length) { + for (let d4 of listing3) { + let subdir4 = subdir3 + '/' + d4 + console.log(subdir4) + } + } + } + } + + } + } + } } /** diff --git a/package-lock.json b/package-lock.json index 8d40a71b..f8a86c5a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "name": "scripts-tykayn", "dependencies": { "exifr": "^7.1.3", + "minimist": "^1.2.8", "moment": "^2.29.4", "node-fs": "^0.1.7" }, @@ -4444,6 +4445,14 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", @@ -8767,6 +8776,11 @@ "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==" + }, "moment": { "version": "2.29.4", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", diff --git a/package.json b/package.json index e8fab726..547726c3 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "scripts-tykayn", "dependencies": { "exifr": "^7.1.3", + "minimist": "^1.2.8", "moment": "^2.29.4", "node-fs": "^0.1.7" }, @@ -16,6 +17,7 @@ "ts-node": "^10.9.1" }, "scripts": { + "devine": "node rangement/index.mjs", "test": "jest" } } diff --git a/rangement/.idea/.gitignore b/rangement/.idea/.gitignore new file mode 100644 index 00000000..73f69e09 --- /dev/null +++ b/rangement/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/rangement/.idea/misc.xml b/rangement/.idea/misc.xml new file mode 100644 index 00000000..28a804d8 --- /dev/null +++ b/rangement/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/rangement/.idea/modules.xml b/rangement/.idea/modules.xml new file mode 100644 index 00000000..f5934d89 --- /dev/null +++ b/rangement/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/rangement/.idea/rangement.iml b/rangement/.idea/rangement.iml new file mode 100644 index 00000000..c956989b --- /dev/null +++ b/rangement/.idea/rangement.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/rangement/.idea/vcs.xml b/rangement/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/rangement/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file