I'd like to script quite a complex process... preferably using a batch file but VBScript would probably be OK, I'm just less familiar with it.
We've got a network location filled with audio files in the format:
The mp2 files are 15 minutes long so there are 96 files in each DD-MM-YY folder, and there are a fixed number of day folders. As a new day is created the oldest is deleted.
I want to create a mirror of the entire tree - but I also want to convert the files to a lower quality sample rate. I can convert individual files using lame.exe like this: (which creates a 16Kbps mono file)
lame --mp2input -m m -a -b 16 file.mp2 file.mp3
I can also convert entire folders using wildcards.
The problem with scripting the process is that every day a new folder is created, and the oldest folder is deleted, so the tree is always changing.
I'm sure it's possible to write a batch file along the lines of:
For every folder in the root
For every file in the folder
Lame command as above
But I don't know the syntax...
I don't want to process files if they already exist in the destination - and I want the process to remove folders from the destination if they no longer exist in the source.
The destination filename will be the same as the source filename, but the extension will be different - sources end in .mp2 - destinations end in .mp3
I could probably use robocopy.exe to do the mirror process and convert afterwards, which would work if robocopy can be told to only rely on filenames BEFORE the extension, and ignores the fact that the files are actually different - but I would still need to know how to convert files in a changing tree!