Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Concatenate all playlists into 1 file

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
 
Try

>! g:\master.m3u
for %x in (e:\nano\*.m3u) copy /A g:\master.m3u + "%x"
 
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
 
I just RTFM and try again but remove the space on either side of the + sign
 
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
 
Does the master list actually play all the songs in the \nano\ playlists? Does combining them actaully work as expected?
 
You could try something like this (with grouping):

Code:
( for %x in (E:\nano\*.m3u) echo %x ) > g:\master.m3u
 
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.
 
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
 
Ahh, ok, I was unsure what you need exactly, sorry. And yes, then it should be enough to replace the echo with type ...
 
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.
 
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.....
 
it seems to me that this should work:
Code:
> master.m3u
do f in *.m3u (copy master.m3u+%f master.m3u)
 
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)
 
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
 
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
 
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
 
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 ...
 
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).
 
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.
 

Similar threads

Back
Top