Mudcat Café Message Lyrics & Knowledge Personal Pages Record Shop Auction Links Radio & Media Kids Membership Help
The Mudcat Cafeawe



User Name Thread Name Subject Posted
Jon Freeman Tech: Rip multiple CDs chronological in mp3 folder (33) RE: Tech: Rip multiple CDs chronological in mp3 folder 02 Jul 21


It would need more work and testing on Windows and things would depend on creation order but I'd probably be looking at a Python3 script along these lines.

import os
import sys
from pathlib import Path

i = 1

def dopaths(currpath):
   
    global i
    global outpath
   
    try:
       paths = sorted(Path(currpath).iterdir(), key=os.path.getctime)
    except:
       print("path not found: " + currpath)
       return
   
    dirname = os.path.basename(currpath)
   
    for afile in paths:
       if (os.path.isdir(afile)):
                dopaths(str(afile))
       elif (".mp3" == os.path.splitext(afile)[1]):
            newname = str(i).zfill(2) + "-" + dirname + "-" + os.path.basename(afile)
            os.rename(afile, os.path.join(outpath, newname))
            i = i + 1
    try:
       os.rmdir(currpath)
    except:
       pass

try:
    dirpath = sys.argv[1]
    outpath = sys.argv[2]
except:
    print("Usage: test2.py sourcepath destpath")
    sys.exit()
   
try:
    os.mkdir(outpath)
except FileExistsError:
    pass
except:
    print("can not create destpath")
    sys.exit()
   
dopaths(dirpath)

--
jon@worthy:~/test> dir testfiles -R
testfiles:
drwxr-xr-x 4 jon users 32 Jul 3 03:09 incds

testfiles/incds:
drwxr-xr-x 2 jon users 53 Jul 3 03:08 disk1
drwxr-xr-x 2 jon users 53 Jul 3 03:10 disk2

testfiles/incds/disk1:
-rw-r--r-- 1 jon users 2 Jul 3 03:07 one.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:08 three.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:08 two.mp3

testfiles/incds/disk2:
-rw-r--r-- 1 jon users 2 Jul 3 03:10 five.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:09 four.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:10 six.mp3

jon@worthy:~/test> python3 test2.py /home/jon/test/testfiles/incds /home/jon/test/testfiles/outcd

jon@worthy:~/test> dir testfiles -R
testfiles:
drwxr-xr-x 2 jon users 154 Jul 3 03:13 outcd

testfiles/outcd:
-rw-r--r-- 1 jon users 2 Jul 3 03:07 01-disk1-one.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:08 02-disk1-two.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:08 03-disk1-three.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:09 04-disk2-four.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:10 05-disk2-five.mp3
-rw-r--r-- 1 jon users 2 Jul 3 03:10 06-disk2-six.mp3


But I don't think most Windows users have Python installed.


Post to this Thread -

Back to the Main Forum Page

By clicking on the User Name, you will requery the forum for that user. You will see everything that he or she has posted with that Mudcat name.

By clicking on the Thread Name, you will be sent to the Forum on that thread as if you selected it from the main Mudcat Forum page.

By clicking on the Subject, you will also go to the thread as if you selected it from the original Forum page, but also go directly to that particular message.

By clicking on the Date (Posted), you will dig out every message posted that day.

Try it all, you will see.