Here’s a little one-liner I use to backup my iTunes music on my Mac OS X systems:
find . -name '*.mp3' -type f -mtime -365 -print0 | xargs -0 tar rvf ~/iTunesBackup.20150118.tar
The way this works is that I move into the Music folder on my OS X system, then run that command, and it creates the tar file shown at the end of the command. This command copies all *.mp3 files that are under the Music folder that have been modified in the last 365 days into the resulting tar file. If you have files other than MP3 files that you want to back up, or if you want to change the date range of the backup file created, just change (or remove) those options in the find
command. Note that the -print0
option is needed to back up filenames and directories that contain blank spaces. (See my Unix/Linux find command examples for many more find
command examples.)