Browse Source

add local script for ipfs container

woonkamer 3 years ago
parent
commit
4526a28807
2 changed files with 25 additions and 0 deletions
  1. 14 0
      localscript/NA-rebueld.sh
  2. 11 0
      localscript/NA-update.sh

+ 14 - 0
localscript/NA-rebueld.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+ ipfs files mkdir /NA_Archive
+ cd /data/NA_Archive
+  
+for file in *
+do
+  hash=$(ipfs add --nocopy -rQ $file)
+  ipfs files cp /ipfs/$hash /NA_Archive/$file
+  echo $file " " $hash
+done 
+
+newfolderhash=$(ipfs files stat --hash /NA_Archive)
+echo "new NA_Archive-hash: "$newfolderhash

+ 11 - 0
localscript/NA-update.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+ ipfs files mkdir /NA_Archive
+ cd /data/NA_Archive
+file=$(ls -tr |tail -n 1)
+  hash=$(ipfs add --nocopy -rQ $file)
+  ipfs files cp /ipfs/$hash /NA_Archive/$file
+  echo $file " " $hash
+
+newfolderhash=$(ipfs files stat --hash /NA_Archive)
+echo "new NA_Archive-hash: "$newfolderhash