As you know, I do all my file management with a CLI interface, Midnight Commander and scripts. It's a slight challenge at first to manage pictures and videos, but it turns out to be much more efficient than a GUI as tools are learned and honed. It's also more 1337 and future proof. Yeah, 1337.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# sort.sh
#
# Cycle through all image files in a directory and prompt for a
# directory in which to move them. Useful for organizing downloaded pics
# after a 4chan, ffffound or other imageboard hunt.
#
# Copyright (c) 2011 Alexandre de Verteuil
# No restrictions. None.

VIEWER="feh --scale-down"
GIFVIEWER="gifview --animate"

f_view () {
    # Spawn the appropriate viewer.
    # Return 1 if not a supported file extension.
    ext=${candidate##.*\.}  # Get extension.
    ext=${ext,,}  # Lowercase.
    case $ext in
        jpg|jpeg|png) $VIEWER "$candidate";;
        gif) $GIFVIEWER "$candidate";;
        *) echo Skipping "${candidate}"...
           return 1
           ;;
    esac
    }

for candidate in $(find . -maxdepth 1 -type f); do
    echo -----------------------------------------------------
    # Show an image
    f_view "$candidate" || continue
    # Print available directories and prompt for a target.
    # Rebuild list of dirs because dirs may be created in the process.
    unset -v dirs
    dirs[0]="."
    i=1
    while read dir; do
        echo $i: $dir
        dirs[$((i++))]="$dir"
    done < <(find . -mindepth 1 -type d -printf '%p\n' | sort)
    echo "Move $candidate to..."
    read -p "...target dir (New,Quit): " target
    case $target in
        ""|"0") continue;;
        n|N) read -p "New directory name: " dirname
             mkdir -v "$dirname" && mv -v "$candidate" "$dirname"
             ;;
        q|Q|quit|exit) exit;;
        *) if [ -d "${dirs[$target]}" ]; then
               mv -v "$candidate" "${dirs[$target]}"
           fi
           ;;
    esac
    sleep 0.5s
done

Possible feature expansion include:

I also plan using a file naming structure such as <id>-tag_tag_tag.<ext> where id is a few random alphanumeric digits. This way, I can use a locate database specifically for my pictures and multimedia or I can just grep directories.

Comments

Comment Atom Feed

There are no comments yet.

Add a Comment

You can use the Markdown syntax to format your comment.