#!/bin/bash FILE="$1"; shift TAG="$(find -type d -printf '%f\n' | dmenu -p "Select a tag for the file")" if [ ! -e "$TAG" ] then mkdir "$TAG" fi if [ -d "$TAG" ] then mv "$FILE" "$TAG" else echo "$TAG is not a directory/tag" >/dev/stderr exit 1 fi