Created
May 21, 2014 02:43
-
-
Save danielbeardsley/033174cbd3a46959651f to your computer and use it in GitHub Desktop.
Script to group and condense my mobile phone pictures after they are synced with Bittorrent Sync
This file contains hidden or 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
#!/bin/bash -e | |
organize_dir() { | |
date=`date +"(%Y-%m-01) Mobile Photos"` | |
base_dir="/cygdrive/c/Users/Danny/Documents/Mobile Photos" | |
dest_dir="$base_dir/$date" | |
source_dir="$base_dir/$1" | |
mkdir -p "$dest_dir" | |
cd "$source_dir" | |
files=$(find ./ -maxdepth 1 -type f \ | |
-not -name '*!sync' \ | |
-not -name '.*' \ | |
-not -wholename ".SyncArchive/*") | |
if [ -z "$files" ]; then | |
echo "No files left in $source_dir" | |
else | |
echo -n "Moving files from $source_dir to $dest_dir ..." | |
mv $files "$dest_dir" | |
echo done | |
fi | |
} | |
organize_dir "Tracy" | |
organize_dir "Danny" | |
echo "Done!" | |
sleep 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment