]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/prune-storage.ts
Add ability to specify channel on registration
[github/Chocobozzz/PeerTube.git] / scripts / prune-storage.ts
index c0cd198f774d37e9de0e25f6527ce0d4749ebb18..4953a74399eb47a7239646bc5fee59b798149cca 100755 (executable)
@@ -1,6 +1,6 @@
 import * as prompt from 'prompt'
 import { join } from 'path'
-import { CONFIG } from '../server/initializers/constants'
+import { CONFIG } from '../server/initializers/config'
 import { VideoModel } from '../server/models/video/video'
 import { initDatabaseModels } from '../server/initializers'
 import { remove, readdir } from 'fs-extra'
@@ -19,7 +19,8 @@ async function run () {
 
   const storageOnlyOwnedToPrune = [
     CONFIG.STORAGE.VIDEOS_DIR,
-    CONFIG.STORAGE.TORRENTS_DIR
+    CONFIG.STORAGE.TORRENTS_DIR,
+    CONFIG.STORAGE.REDUNDANCY_DIR
   ]
 
   const storageForAllToPrune = [
@@ -36,6 +37,9 @@ async function run () {
     toDelete = toDelete.concat(await pruneDirectory(directory, false))
   }
 
+  const tmpFiles = await readdir(CONFIG.STORAGE.TMP_DIR)
+  toDelete = toDelete.concat(tmpFiles.map(t => join(CONFIG.STORAGE.TMP_DIR, t)))
+
   if (toDelete.length === 0) {
     console.log('No files to delete.')
     return