Picasa
From Attie's Wiki
(Difference between revisions)
(Created page with "==Extract a copy of all of the starred photos== <source lang="bash"> #!/bin/bash DEST=~/starred_photos SRC=. if [ -e "${DEST}" ]; then echo "${DEST} already exists!" ech...") |
m (→Extract a copy of all of the starred photos) |
||
(One intermediate revision by one user not shown) | |||
Line 42: | Line 42: | ||
fi | fi | ||
− | |||
if [ ! -e "${d}" ]; then | if [ ! -e "${d}" ]; then | ||
+ | echo "Copy: '${s}'" | ||
cp "${s}" "${d}" | 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 | fi | ||
done | done | ||
done | done | ||
− | |||
</source> | </source> |
Latest revision as of 20:05, 3 August 2014
[edit] 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