up deps folder listing node

This commit is contained in:
Tykayn 2023-07-29 16:52:53 +02:00 committed by tykayn
parent 975850a7e1
commit 9442153b32
8 changed files with 87 additions and 27 deletions

View File

@ -1,25 +1,25 @@
// lister les dossiers dans le dossier stockage syncable pour en tirer une liste de dates d'évènements // 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 = '' 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 * obtenir une liste des dossiers uniquement dans le dossier courant
* @param path * @param path
* @returns {*} * @returns {*}
*/ */
function getDirectories(path) { function getDirectories (path) {
return fs.readdirSync(path).filter(function (file) { return fs.readdirSync(path).filter(function (file) {
return fs.statSync(path + '/' + file).isDirectory(); return fs.statSync(path + '/' + file).isDirectory()
}); })
} }
/** /**
* lister 3 sous niveaux de dossiers * lister 3 sous niveaux de dossiers
* @param folders * @param folders
*/ */
function recursiveListing(folders){ function recursiveListing (folders) {
for (let dossier of folders) { for (let dossier of folders) {
@ -30,13 +30,21 @@ function recursiveListing(folders){
if (listing.length) { if (listing.length) {
// console.log('', listing) // console.log('', listing)
for (let d2 of listing) { for (let d2 of listing) {
let subdir2 = folder_photo + '/' + dossier+'/'+d2 let subdir2 = folder_photo + '/' + dossier + '/' + d2
console.log(subdir2) console.log(subdir2)
let listing2 = getDirectories(subdir1) let listing2 = getDirectories(subdir1)
if (listing2.length) { if (listing2.length) {
for (let d3 of listing2) { for (let d3 of listing2) {
let subdir3 = subdir2 +'/'+d3 let subdir3 = subdir2 + '/' + d3
console.log(subdir3) console.log(subdir3)
let listing3 = getDirectories(subdir2)
if (listing3.length) {
for (let d4 of listing3) {
let subdir4 = subdir3 + '/' + d4
console.log(subdir4)
}
}
} }
} }

14
package-lock.json generated
View File

@ -7,6 +7,7 @@
"name": "scripts-tykayn", "name": "scripts-tykayn",
"dependencies": { "dependencies": {
"exifr": "^7.1.3", "exifr": "^7.1.3",
"minimist": "^1.2.8",
"moment": "^2.29.4", "moment": "^2.29.4",
"node-fs": "^0.1.7" "node-fs": "^0.1.7"
}, },
@ -4444,6 +4445,14 @@
"node": "*" "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": { "node_modules/moment": {
"version": "2.29.4", "version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
@ -8767,6 +8776,11 @@
"brace-expansion": "^1.1.7" "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": { "moment": {
"version": "2.29.4", "version": "2.29.4",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",

View File

@ -2,6 +2,7 @@
"name": "scripts-tykayn", "name": "scripts-tykayn",
"dependencies": { "dependencies": {
"exifr": "^7.1.3", "exifr": "^7.1.3",
"minimist": "^1.2.8",
"moment": "^2.29.4", "moment": "^2.29.4",
"node-fs": "^0.1.7" "node-fs": "^0.1.7"
}, },
@ -16,6 +17,7 @@
"ts-node": "^10.9.1" "ts-node": "^10.9.1"
}, },
"scripts": { "scripts": {
"devine": "node rangement/index.mjs",
"test": "jest" "test": "jest"
} }
} }

8
rangement/.idea/.gitignore vendored Normal file
View File

@ -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/

6
rangement/.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/rangement.iml" filepath="$PROJECT_DIR$/.idea/rangement.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
rangement/.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>