Batch copying folder.jpg in music folder to CD subfolders

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
bartpet
Posts: 18
Joined: 27 Aug 2023 13:33

Batch copying folder.jpg in music folder to CD subfolders

Post by bartpet »

Posted 16 hours ago
Hello,

I am renaming and converting my music library (on a QNAP NAS) to make it ideal for use in Emby. My Library looks like this:

>Music

        >Artist - Album-name

                >CD 1 (with mp3 or flac or alac content)

                >CD 2 (with mp3 or flac or alac content)

                >CD 3 (with mp3 or flac or alac content)

                >booklet folder

                >folder.jpg

My question is: how can i batch copy (or move) all the folder.jpg files into the subfolders CD 1 CD2 etc.? I have a collection of more than 1000 CD's all aranged in the way of the example above. It would be great if there is an app that can do this like a batch copy-task. I'm not into writing batch files (yet)

All music files have embedded covers. These have different dimensions: 200px200p, 600px600p etc. I want to standarize these embedded coveres with newly scanned and downloaded covers with bigger dimensions: 1200px1200p. The folder.jpg in the example above is 1200x1200. I'm using MP3TAG to import the folder.jpg into the tag using "import cover from file". To do this properly all the folder.jpg need to be in the CD folders, otherwise it doesn't work.

Any advice will be appreciated 

Greetings 

bart

 

highend
Posts: 14926
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by highend »

Each folder.jpg should be copied into all CD 1, CD 2, CD <x> subfolders?
The name pattern is always CD <one digit number>?
One of my scripts helped you out? Please donate via Paypal

bartpet
Posts: 18
Joined: 27 Aug 2023 13:33

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by bartpet »

highend wrote: 27 Aug 2023 14:03 Each folder.jpg should be copied into all CD 1, CD 2, CD <x> subfolders?
The name pattern is always CD <one digit number>?
Thanks for your quick reply. there are several hundreds of Album Folders with at least 2 CD folders. The CD folders are named CD 01, CD 02 etcetera. So a 2 digit number for the CD folders. the folder.jpg is in the album folders and should be copied (or moved) to the CD folders.

highend
Posts: 14926
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by highend »

Change $root to the full path of your root music folder first!

If I were you I'd copy a small subset of your data into a test folder and use the script on this first to make sure everything went fine...

Code: Select all

    // Move all folder.jpg files into all existing CD 01, CD 02, CD <xx> subfolders
    $root = "D:\!tests\Music";
    end (exists($root) != 2), quote($root) . " folder does not exist, aborted!";

    $jpgs = quicksearch("folder.jpg", $root, , "s");
    end (!$jpgs), "No folder.jpg file(s) found, aborted!";

    setting "BackgroundFileOps", 0;
    foreach($jpg, $jpgs, <crlf>, "e") {
        $path = gpc($jpg, "path");
        $subs = quicksearch("CD* /d", $path);
        if (!$subs) { continue; }

        foreach($sub, $subs, <crlf>, "e") {
            copyto $sub, $jpg, , 2, 2, 2, 1, 0, 0, 1, 0, 0;
        }
        runret(lax("cmd" /c DEL /F /Q "$jpg"), "%TEMP%");
    }
One of my scripts helped you out? Please donate via Paypal

bartpet
Posts: 18
Joined: 27 Aug 2023 13:33

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by bartpet »

Thank you so much for this

In my question i forgot to mention this:
In some CD folders, the folder.jpg is already present. This folder.jpg is a cover for the specific CD. in some cases each CD of a CD box has its own specific cover. Most multiCD Albums have only 1 cover (folder.jpg) for all CDs

So in the case there is only 1 cover for all CDs, i don't have any folder.jpg in the CD folders
in the case that there is a specific cover for every CD in the CD-box, I do have a folder.jpg in every CD folder. These folder.jpg shouldn't be overwritten. Is that posible with the script you send me?

Sorry for the inconvenience

Greetings
Bart

highend
Posts: 14926
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by highend »

Use copyto $sub, $jpg, , 2, 2, 3, 1, 0, 0, 1, 0, 0; instead?
One of my scripts helped you out? Please donate via Paypal

bartpet
Posts: 18
Joined: 27 Aug 2023 13:33

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by bartpet »

Yes that's it. Thank you very much

bartpet
Posts: 18
Joined: 27 Aug 2023 13:33

Re: Batch copying folder.jpg in music folder to CD subfolders

Post by bartpet »

It has worked to perfection Highend,
Thank you so much. It has spared me so much work.

Greetings

Post Reply