The following scans recursively for all MP3 files modified in the last 30 days and add them to iTunes library.

cd $MEDIA_DIR
find . -type f -name '*.mp3' -mtime -30 -print0 | xargs -t -0 open -a iTunes
osascript -e 'tell application "iTunes" to pause'

Obviously, you should set/change $MEDIA_DIR to the directory you want to scan from. Opening the files should add them to the iTunes library, but it also makes iTunes play the files, so the last line is there to make iTunes pause as soon as the files are added.

On 20 November 2011

Comments