Created
October 10, 2016 05:21
-
-
Save janlay/830f2fc9946b5a7eeca5876676bd3b74 to your computer and use it in GitHub Desktop.
Archive desktop files into yyyy-mm subdirectory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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