Picasa

From Attie's Wiki
Revision as of 20:05, 3 August 2014 by Attie (Talk | contribs)

Jump to: navigation, search

Extract a copy of all of the starred photos

#!/bin/bash
 
DEST=~/starred_photos
SRC=.
 
if [ -e "${DEST}" ]; then
	echo "${DEST} already exists!"
	echo -n "continuing in 3..."
	sleep 1
	echo -en "\rcontinuing in 2..."
	sleep 1
	echo -en "\rcontinuing in 1..."
	sleep 1
	echo -en "\r                  \r"
fi
mkdir -p "${DEST}"
cd "${SRC}"
find . -name '.picasa.ini' | \
while read i; do
	I=$(dirname "${i}")
	cat "${i}" | \
		dos2unix | \
		awk 'BEGIN{k=0;f=""}{if(substr($0,0,1)=="["){f=substr($0,2,length($0)-2)}else if($0=="star=yes"){print f}}' | \
		while read i; do
			s=${I}/${i}
			S=$(dirname "${s}")
			d="${DEST}/$(echo "${s}" | cut -b 3-)"
			D=$(dirname "${d}")
 
			if [ ! -e "${D}" ]; then
				mkdir -p "${D}"
			elif [ ! -d "${D}" ]; then
				echo "'${D}' is not a directory..."
				break
			fi
 
			if [ "${d}" != "$(readlink -f "${d}")" ]; then
				echo "ERROR... readlink mismatch"
				exit 1
			fi
 
			if [ ! -e "${d}" ]; then
				echo "Copy: '${s}'"
				cp "${s}" "${d}"
			else
				SS=$(cat "${s}" | sha256sum -b -)
				SD=$(cat "${d}" | sha256sum -b -)
				if [ "${SS}" != "${SD}" ]; then
					echo "Copy: '${s}' (checksum mismatch)"
					cp "${s}" "${d}"
				fi
			fi
		done
done
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox