0

I am trying to join/concatenate multiple audio files into 1 auto file. I created a simple batch file using the copy command to do this however when processing the files it goes in the order audio1,audio10,etc instead of audio1,audio2,etc

I have searched on here but people are using more complex joining methods and I can't extrapolate the code section that would help process the files in the order I need.

Can someone help this noob?

@echo off
echo What do you want to name the new merged file?
set /p input=""
echo %input%
copy /b *.mp3 %input%.mp3
move %input%.mp3 ./Merged
del /f *.mp3
pause
philipxy
  • 14,867
  • 6
  • 39
  • 83
  • 2
    Have you considered zero-padding the numbers in the filenames? – SomethingDark Jul 26 '18 at 15:06
  • 1
    The [sortn.bat](https://www.dostips.com/?t=Batch.SortTextWithNumbers) should help. – Squashman Jul 26 '18 at 16:21
  • Do the file names follow a certain pattern? – aschipfl Jul 26 '18 at 16:32
  • The file names are 1.mp3 2.mp3 – Caleb Spring Jul 26 '18 at 17:06
  • I see how to pipe dir into sortn but I am not sure how to implement it with my above script. – Caleb Spring Jul 26 '18 at 17:15
  • Why do you think you can simply binary copy together multiple *.mp3 files into one working *.mp3 file? Please take a careful look on Wikipedia article about [MP3](https://en.wikipedia.org/wiki/MP3) and especially on file structure diagram of MP3 files. Then read [What is the best way to merge mp3 files?](https://stackoverflow.com/questions/62618/) Last use a tool designed for [merging MP3 files](https://listoffreeware.com/list-of-best-free-software-to-join-mp3-files/). I have just used my favorite www search engine with `merge mp3 files` and `join mp3 files` to find all needed information. – Mofi Jul 26 '18 at 17:21
  • Wait I think I got it. @echo off echo What do you want to name the new merged file? set /p input="" echo %input% copy /b *.mp3 %input%.mp3 | sortn move %input%.mp3 ./Merged del /f *.mp3 pause – Caleb Spring Jul 26 '18 at 17:22
  • @Mofi I also used my favorite search engine and found the basis for my script and it works for combining MP3 however it messes up once it gets to 10 as outlined in my question. I guess I am not looking for 'valid' MP3s as you put it just ones that play in VLC which the output does. – Caleb Spring Jul 26 '18 at 17:46
  • My solution to add | sortn didn't work. – Caleb Spring Jul 26 '18 at 18:03

0 Answers0