Skip to content

Instantly share code, notes, and snippets.

@clathrop
Last active August 29, 2015 14:23
Show Gist options
  • Save clathrop/8b3701bdc30f9caea729 to your computer and use it in GitHub Desktop.
Save clathrop/8b3701bdc30f9caea729 to your computer and use it in GitHub Desktop.
This nifty script hunts for mp3 files within a specified dir (default is ~/Downloads) and moves them to the "Automatically Add to Itunes" folder in the ITUNES_HOME dir
#!/bin/bash
# This nifty script hunts for mp3 files within a specified dir
# (default is ~/Downloads) and moves them to the "Automatically
# Add to Itunes" folder in the ITUNES_HOME dir
itunesAuto="${ITUNES_HOME}/iTunes Media/Automatically Add to iTunes/"
downloadsDir="${HOME}/Downloads"
files=$(shopt -s nullglob dotglob; echo $downloadsDir/*.mp3)
if(( ${#files} ))
then
for f in $downloadsDir/*.mp3
do
echo "moving $f to $itunesAuto"
mv "$f" "$itunesAuto"
done
else
echo "No .mp3s in Downloads to move..."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment