Re: [Hampshire] Selective file copy

Top Page

Reply to this message
Author: Simon Reap
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Selective file copy
Something like:

cd /media/nas/music
find . -name \*.mp3 | while read nam; do
mkdir -p "/media/data/MP3/$(dirname $nam)"
cp "$nam" "/media/data/MP3/$nam"
done

On 02/05/2014 08:55 AM, LUG wrote:
> Hello all,
> I'm hoping to call on the group's collective bash-fu to come up with
> an incantation that will make this task a lot easier.
>
> The situation is:
> - Nas drive at /media/nas/music which contains music files as
> /Artist/Album/<<multiple tracks>>.
>
> - Data drive at /media/data/MP3 which then has the same
> /Artist/Album/<<multiple tracks>> layout.
>
> The music on the NAS is a mixture of FLAC and MP3 (and probably some
> WMA, but let's ignore them for the moment) depending on whether it was
> ripped from a CD (FLAC) or downloaded (MP3).
>
> What I would like to do is copy the MP3s to the /media/data/MP3
> folder, along with their corresponding folder structure.
>
> So for example, if the NAS contains
> /Artist_A/Album_1/Song[1-10].flac
> as well as
> /Artist_A/Album_2/Song[1-10].mp3
>
> I want to just copy the MP3s along with the /Artist_A/Album_2 folder
> structure.
>
> This is made more complicated by the fact that the /media/data/MP3
> folder already has the Artist/Album/tracks structure in it as I have
> converted the FLACs into MP3s using that as the output folder (there
> wasn't enough room on the NAS to do them in-situ).
>
> Does that sound possible?
>
> Thanks,
> Keith
>
>
>
>


--
Please post to: Hampshire@???
Web Interface: https://mailman.lug.org.uk/mailman/listinfo/hampshire
LUG URL: http://www.hantslug.org.uk
--------------------------------------------------------------