HowTo:AndroidPhoto
One-time setup: <source lang="bash"> aptitude install libusb1-dev golang-go mtp-tools fuse-utils libfuse2 mtp-detect # (will tell you specific vendor and product id)
- These id-s (18d1 and 4ee1) are specific for the Nexus 4:
echo 'ATTRS{idVendor}=="18d1",ATTRS{idProduct}=="4ee1",MODE="0666",GROUP="plugdev"' >/etc/udev/rules.d/50-android.rules
- - add yourself to 'fuse' group (fuse line in /etc/group)
- - log back in to take effect
mkdir $HOME/golang export GOPATH=$HOME/golang go get github.com/hanwen/go-mtpfs
ln -s $GOPATH/bin/go-mtpfs $HOME/bin </source>
Since the picture filenames all contain the date (e.g. IMG_20130401_000007.jpg), you can use cut to sort them by month. <source lang="bash">
- mtp-detect
- go-mtpfs droid
- cd droid/Internal\ storage/DCIM/Camera
for i in *; do
d=`cut -d _ -f 2 <<<"$i"` y=`cut -b 1-4 <<< $d` m=`cut -b 5-6 <<< $d` mkdir -p ~/Pictures/$y/$m cp "$i" ~/Pictures/$y/$m echo "$i"
done
- cd
- fusermount -u droid
</source>
Otherwise, sorting by file date would have required <source lang="bash"> find . -newermt "01/01/2013" -and -not -newermt "02/01/2013" </source> (which lists the file in the month you're looking for).