Skip to content

Instantly share code, notes, and snippets.

@janlay
Created October 10, 2016 05:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janlay/830f2fc9946b5a7eeca5876676bd3b74 to your computer and use it in GitHub Desktop.
Save janlay/830f2fc9946b5a7eeca5876676bd3b74 to your computer and use it in GitHub Desktop.
Archive desktop files into yyyy-mm subdirectory
filename=`basename "$1"`
[[ "$filename" == "Archive" ]] && exit 1
target=`stat -f '%Sc' -t '%Y-%m' "$1"`
fullpath="$HOME/Desktop/Archive/$target"
mkdir -p "$fullpath"
mv "$1" "$fullpath/"
script="display notification \"$filename -> Archive/$target\" with title \"Desktop file archived\""
osascript -e "$script"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment