Skip to content

Instantly share code, notes, and snippets.

@foomin10
Created March 23, 2022 03:07
Show Gist options
  • Save foomin10/759bd6b3f02c43754ed88825df7d277b to your computer and use it in GitHub Desktop.
Save foomin10/759bd6b3f02c43754ed88825df7d277b to your computer and use it in GitHub Desktop.
#! /bin/env bash
set -eu -o pipefail
twitter_pic() {
src=/storage/emulated/0/Android/data/com.twitter.android/cache/image_cache/v2.ols100.1
#echo >&2 "src: $src"
cd -- "$src" || _error
export -f _find1
find . -depth -mindepth 1 -maxdepth 2 -name "*.cnt" -type f -size -11k -delete
find . -depth -mindepth 1 -maxdepth 2 -name "*.cnt" -type f -exec bash -c _find1 "{}" \;
find . -depth -mindepth 1 -maxdepth 1 -type d -empty -delete
return 0
}
_find1() {
p="$0"
d="${p%.cnt}.jpg"
d="${d##*/}"
#printf "$d"
dist=/storage/emulated/0/Pictures/_twi
#echo >&2 "dist: $dist"
mv -- "$p" "$dist/$d"
return 0
}
_error() {
echo >&2 "twitter-pic: error"
return 1
}
twitter_pic "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment