Concatenate all playlists into 1 file

Sep 6, 2020
6
0
I want to "merge" all playlists in directory in to a single master playlist. I tried using COPY /A but all I got was the last file in the source directory

Code:
for %x in (e:\nano\*.m3u) copy /A "%x" g:\master.m3u
 
Sep 6, 2020
6
0
Here's what I got:

Code:
[C:\Program Files\JPSoft\TCMD22]for %x in (e:\nano\*.m3u) copy /A "%x" g:\master.m3u + "%x"
E:\nano\1975.m3u => G:\master.m3u+e:nano\1975.m3u
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
 "G:\master.m3u+e:nano\1975.m3u"
     0 files copied       1 failed
 
Sep 6, 2020
6
0
I removed the spaces from around the plus sign, but still got the same error. I tried creating an empty destination file "g:\master.m3u" first. Same error.

Code:
[C:\Program Files\JPSoft\TCMD22]for %x in (e:\nano\*.m3u) copy /A "%x" g:\master.m3u+"%x"
E:\nano\1975.m3u => G:\master.m3u+e:nano\1975.m3u
TCC: (Sys) The filename, directory name, or volume label syntax is incorrect.
"G:\master.m3u+e:nano\1975.m3u"
     0 files copied       1 failed

Why isn't there a backslash after the e: in the error msg?

If I just echo %x I get this

Code:
[C:\Program Files\JPSoft\TCMD22]for %x in (e:\nano\*.m3u) echo %x
e:\nano\1975.m3u
e:\nano\1976.m3u
e:\nano\1977.m3u
e:\nano\1978.m3u
e:\nano\1979.m3u
e:\nano\1980.m3u
e:\nano\1981.m3u
e:\nano\1982.m3u
e:\nano\1983.m3u
e:\nano\1984.m3u
e:\nano\1985.m3u
e:\nano\1986.m3u
e:\nano\1987.m3u
e:\nano\1988.m3u
e:\nano\1989.m3u
e:\nano\1990.m3u
e:\nano\1991.m3u
e:\nano\1992.m3u
e:\nano\1993.m3u
e:\nano\1994.m3u
e:\nano\1995.m3u
e:\nano\1996.m3u
e:\nano\1997.m3u
e:\nano\1998.m3u
e:\nano\1999.m3u
e:\nano\2000.m3u
e:\nano\2001.m3u
e:\nano\2002.m3u
e:\nano\2003.m3u
e:\nano\2004.m3u
e:\nano\70s-90s.m3u
 
Apr 2, 2011
1,290
3
53
North Carolina, USA
Does the master list actually play all the songs in the \nano\ playlists? Does combining them actaully work as expected?
 
Sep 6, 2020
6
0
Does the master list actually play all the songs in the \nano\ playlists? Does combining them actaully work as expected?
No, the "master" playlist is just to get a list of songs referred to by all of the playlists. I will use that list to copy songs to my phone. Basically, I want to only copy songs that are belong to a playlist.
 
Sep 6, 2020
6
0
You could try something like this (with grouping):

Code:
( for %x in (E:\nano\*.m3u) echo %x ) > g:\master.m3u
That just echos the filenames into master.m3u. I need the contents of the files copied into master.m3u. I guess that would be TYPE instead of ECHO
 
Jan 12, 2014
399
7
Switzerland, SO
Yes, if he don't need the FOR (I made the example only, because he asked explicite for the loop variant), an easy ...

Code:
type e:\nano\*.m3u > g:\master.m3u

would be enough.
 
Apr 2, 2011
1,290
3
53
North Carolina, USA
Are the *.m3u files basically all text? I found this online: " An M3U file is a media playlist file supported by several media players such as Winamp and iTunes. It contains a playlist of MP3s and other audio or video files and lists the locations of media files in a plain text format. ". so yes - if you type *.m3u then no beeps or whatever will be there.....
 

samintz

Scott Mintz
May 20, 2008
1,433
13
Solon, OH, USA
You'll need the appropriate switches if you have overwrite checking turned on.
e.g. Copy Prompt on Overwrite and Protect Redirected Output Files.
Code:
>! master.m3u
do f in *.m3u (copy /y master.m3u+%f)
 

oph

Jun 28, 2008
42
0
Yes, if he don't need the FOR (I made the example only, because he asked explicite for the loop variant), an easy ...

Code:
type e:\nano\*.m3u > g:\master.m3u

would be enough.

With > you will end with the last .m3u in master.m3u

You must use

Code:
type e:\nano\*.m3u >> g:\master.m3u
 
May 20, 2008
10,671
83
Syracuse, NY, USA
With > you will end with the last .m3u in master.m3u

You must use

Code:
type e:\nano\*.m3u >> g:\master.m3u

I don't think that's correct.

Code:
v:\> type *.btm > master.btm

v:\> dir /k /m m*.btm
2020-09-17  11:05          46,233  master.btm
2020-08-04  15:48             183  mytc.btm
2019-11-10  17:31             441  myversion.btm
 
May 20, 2008
10,671
83
Syracuse, NY, USA
That example is a bit faulty because MASTER.BTM is in the same directory (and was partially copied to itself, I think). Here's a better one. I'm not sure why the size of master.btm doesn't match perfectly with the BTM bytes reported by DIR.

Code:
v:\> dir /k /u2 *.btm
              37,374 bytes in 53 files and 0 dirs    217,088 bytes allocated
     504,297,627,648 bytes free

v:\> type *.btm > hold\master.btm

v:\> dir /k /m hold\master.btm
2020-09-17  11:25          37,371  master.btm
 
Jan 12, 2014
399
7
Switzerland, SO
With > you will end with the last .m3u in master.m3u

You must use

Code:
type e:\nano\*.m3u >> g:\master.m3u
Both seems possible, my and your variant, see here:

m3u-master_files.PNG
m3u-master_my-variant.PNG
m3u-master_your-variant.PNG


I just used another drive letters, else it's the same ...
 
Jan 12, 2014
399
7
Switzerland, SO
And his output file is on another drive in his example, so this should be no problem ...

@oph Try exactly my steps and you will highly probably have success too ... else, if you have the output file in the source directory too, try with exclusion range, how Charles Dye said (I haven't tested that).
 

oph

Jun 28, 2008
42
0
And his output file is on another drive in his example, so this should be no problem ...

@oph Try exactly my steps and you will highly probably have success too ... else, if you have the output file in the source directory too, try with exclusion range, how Charles Dye said (I haven't tested that).

I am using since a lot of time ago:

del total.f
type *.f >>total.f

to concatenate all the Fortran files of a big program

The key when one works in the same directory is to delete previously the "accumulator", or to use an exclusion range.

In this case, the order of files is not important, the compiler works well.

If the order is important, I use a .btm command file.