about summary refs log tree commit diff
path: root/modules/mediasync
blob: 074a8b8915516762351c83526b2fa0172715ae68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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