Skip to content

Instantly share code, notes, and snippets.

Created January 2, 2015 01:42
Show Gist options
  • Save anonymous/a0b4ea3ba123ed956f41 to your computer and use it in GitHub Desktop.
Save anonymous/a0b4ea3ba123ed956f41 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>EnvironmentVariables</key>
<dict>
<key>COLLECTION_FOLDER</key>
<string>/Users/your_account_name/Documents/DailyCollection</string>
<key>TARGET_FOLDER</key>
<string>/Users/your_account_name/Desktop/ToDay</string>
</dict>
<key>Label</key>
<string>daily-collector</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>DESTINATION_FOLDER="$COLLECTION_FOLDER/$(date -v-24H +'%Y-%m-%d')"
[ -d "$DESTINATION_FOLDER" ] &amp;&amp; exit 0
[ ! -d "$TARGET_FOLDER" ] &amp;&amp; exit 1
cd "$TARGET_FOLDER"
/bin/ls -1a | awk '/^\.$/||/^\.\.$/||/\.DS_Store/{next}{exitCode=1;exit}END{exit exitCode}' &amp;&amp; exit 0
mkdir -p "$DESTINATION_FOLDER"
/bin/ls -1a | awk '/^\.$/||/^\.\.$/||/\.DS_Store/{next}{print $0}' | while read item
do
mv "$item" "$DESTINATION_FOLDER"
done
exit 0</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartCalendarInterval</key>
<array>
<dict>
<key>Hour</key>
<integer>0</integer>
<key>Minute</key>
<integer>1</integer>
</dict>
</array>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment