Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #
- # A script to download photos and videos you took with your cellphone via Bluetooth. It downloads only files lacking locally
- # It is nice to put it in crontab
- # You phone must be paired with computer already
- # The phone is not necessarily must be blutooth discoverable
- #
- # This script is GNU/GPLv3 Free Software
- #
- # Anton Tesla Starikov, teesla@gmail.com
- #
- phonemac="00:1D:28:FA:A2:AB"
- phonedir="/Memory Stick/DCIM/100MSDCF"
- localdir="/home/tesla/Pictures/Phone/"
- localtmp="/tmp/"
- mkdir $localdir
- #get list from phone
- obexftp -b $phonemac -c "$phonedir" -l | grep "file name" | awk -F\" '{print $2}' | sort > $localtmp.phonelist.tmp
- #get list from HDD
- ls -1 $localdir | sort > $localtmp.hddlist.tmp
- #findout what we are lacking locally
- #sorting in back order since usually we need newer files most, so we get them first
- diff $localtmp.phonelist.tmp $localtmp.hddlist.tmp|grep "<"|awk '{print $NF}' | sort -r > $localtmp.difference.tmp
- #if there is anything we are lacking
- if [ -s $localtmp.difference.tmp ]; then
- cd $localdir
- #for each file lacking
- while read line; do
- touch $line
- #get it
- #you can commentout obexftp if you dont really want all those files but rather their placeholders
- obexftp -b $phonemac -c "$phonedir" -g $line
- done < $localtmp.difference.tmp
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement