Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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