Skip to content

Instantly share code, notes, and snippets.

@danielbeardsley
Created May 21, 2014 02:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbeardsley/033174cbd3a46959651f to your computer and use it in GitHub Desktop.
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
#!/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