This command successfully created the file named music.tar, which I just copied to another Mac and tested there. name -type f '*.mp3' -mtime -180 -print0 | xargs -0 tar rvf music.tar A `find` + `tar` command to handle spacesĪfter opening a Mac Terminal window and changing to the Music folder on my computer (/Users/Al/Music), all I needed was this one command to create a tar file of all the songs on my system that have been modified in the last 180 days (which is essentially six months):įind. Fortunately we can get around this problem on Mac OS X systems, as you'll see here. If you know Unix, you know spaces in directory and filenames wreaks havoc with Unix tools. Just looking at the Music folder, it contains many directory names like this: The problem with trying to do this with standard Unix tools is that all these subdirectories and filenames have spaces in their names. These are all on my Mac OS X system, under the Music folder in my home directory. This morning I decided to take a few minutes to backup all the songs I've purchased over the last half-year.
0 Comments
Leave a Reply. |