Permalink
Browse files

migrate to rds "flat files"

  • Loading branch information...
gordonwoodhull committed Sep 13, 2013
1 parent f71adb1 commit b1f97b1070546fbb01f785d18c7b73abd574d746
Showing with 20 additions and 0 deletions.
  1. +20 −0 scripts/migrate2ff.sh
View
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+## Migrates old file-based store to new RDS flat-file structure
+##
+## This scripts reads *.json files from data/userfiles and
+## stores them in the expected locations for RDS flat files,
+## the new default RCS engine
+
+if [ ! -e "data/userfiles" ]; then
+ echo '' >&2
+ echo " $0 must be run from the RCloud root" >&2
+ echo '' >&2
+ exit 1
+fi
+
+for f in data/userfiles/*.json; do
+ u=`echo $f | sed 's:data/userfiles/\(.*\)\.json:\\1:'`
+ mkdir -p data/rcs/$u/system
+ echo "saveRDS(readLines('$f'), 'data/rcs/$u/system/config.json')" | R --vanilla --slave
+done

0 comments on commit b1f97b1

Please sign in to comment.