Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrs/54938ef173b120eff12b to your computer and use it in GitHub Desktop.
Save vrs/54938ef173b120eff12b to your computer and use it in GitHub Desktop.
#!/bin/sh
# canything can be found here: https://github.com/keiji0/canything
focus=$(xdotool getwindowfocus)
list="./folders"
tosort=$1
if [ -z "$tosort" ]
then
echo "read script source."
exit 1
fi
for file in "$tosort/"*; do
feh -d. "$file" &
sleep 0.3
xdotool windowfocus "$focus"
dest=$(sort "$list" |uniq -c |sort -nr |sed 's/^ *//' |canything |sed 's/^[0-9]* *//' |tee -a "$list")
mv -v -n -t "$dest" "$file"
killall feh
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment