about summary refs log tree commit diff
path: root/modules/mediasync
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mediasync')
-rwxr-xr-xmodules/mediasync24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/mediasync b/modules/mediasync
new file mode 100755
index 0000000..074a8b8
--- /dev/null
+++ b/modules/mediasync
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+## Sync media files with my external drive at `/media`
+## Only cp from home: vids, music, pics, books
+## If you delete file from home it won't be deleted from `/media`
+
+tosync=`ls -d $HOME/{vids,music,pics}` #,books}`
+dest="/media"
+
+#if [ -L "/dev/disk/by-label/media" ]; then
+#  sudo mount /dev/disk/by-label/media $dest
+#else
+#  echo "Could not mount media drive"
+#  exit 1
+#fi
+
+if [ -z "$(ls -A /media)" ]; then
+   echo "Is disk on?"
+   exit 1
+fi
+
+for folder in $tosync; do
+  rsync -aP $folder $dest
+done