Online orders are continuing to be processed as normal. Our showroom will re-open on Monday 15 June. Please call 01183218292 to book an appointment to visit.
Covid-19
Online orders are continuing to be processed as normal. Our showroom will re-open on Monday 15 June. Please call 01183218292 to book an appointment to visit.

Copy Files using Mac Command Line

Using Rsync to Copy files

Copy Files using Mac Command Line

You may have a music folder structure that contains a mix of file types.

e.g. Folder Name

./source/Al Green/Back 2 Back Hits

Folder contents:

01 - Let's Stay Together (live).flac
01 - Let's Stay Together (live).wav
01 - Let's Stay Together (live).mp3

02 - You Ought to be With Me.flac
02 - You Ought to be With Me.wav
02 - You Ought to be With Me.mp3
.
.
folder.jpg

Now assume we want to separate the files into folders based on file types.

On a Mac computer (or Linux) we can use the rsync command line from a Terminal (Applications -> Utilities) as follows:

rsync --zarv --include="*/" --include="*.mp3" --include="*.jpg" --exclude="*" ./source ./MP3/

This will copy all mp3 and jpg files from the source folder to the MP3 folder.

Source Folder 

Source Folder
Source Folder containing multiple file types.

 

Result in Destination

File Copy

Note the previous command will copy the files leaving the copied files in the original folders.

If you want to move the files (just the MP3) into the new folder use the following command:

Caution - there is no undo - so test first on a sample folder!

rsync --zarv --include="*/" --include="*.mp3"  --exclude="*" --remove-source-files ./source ./MP3/