Concatenate all playlists into 1 file

Sep 6, 2020
9
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
 
Apr 2, 2011
1,441
10
54
North Carolina, USA
Try

>! g:\master.m3u
for %x in (e:\nano\*.m3u) copy /A g:\master.m3u + "%x"
 
Sep 6, 2020
9
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
 
Apr 2, 2011
1,441
10
54
North Carolina, USA
I just RTFM and try again but remove the space on either side of the + sign
 
Sep 6, 2020
9
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,441
10
54
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
9
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
9
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
426
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,441
10
54
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,503
16
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
44
1
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
11,400
99
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
11,400
99
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
426
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
426
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
44
1
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
Thread starter Title Forum Replies Date
B Can copy command concatenate multiple mp3 files Support 2
T Concatenate echoed text with the results of a grep command? Support 2
J History file load hangs if file has complete garbage in it... Support 1
jdanielp Cannot step into and/or call another .bat file when debugging .bat file Support 2
thorntonpg file explorer - short cut keys Support 1
JohnQSmith New online help file wrong logo Support 7
Jay Sage WAD Possible Bug With OPTION Command With @FILE Support 5
samintz How to? swap endianness in a binary file Support 12
vefatica `Back quotes` - command line vs. batch file Support 5
fpefpe How to? batch file size Support 2
Jay Sage Issues With TCMD File Explorer Support 0
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
Joe Caverly @FILESIZE and NTFS File Stream Support 1
Joe Caverly Embedding an .EXE (or other file) into a .BTM Support 8
U Command help on file names Support 5
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
Joe Caverly Rename file that begins with Emoji Support 7
Joe Caverly PSHELL and NTFS File Streams Support 2
P Kill all other instances of tcc from a btm batch file Support 2
D ffind hangs on large file Support 18
Alpengreis Documentation Minor issue in help file for view /E Support 1
fpefpe batch file ending early Support 18
J Licesne file location Support 1
K robocopy cancelling batch file processing Support 28
Jay Sage TCMD Crashes with "tctoolbar /c /r file" Support 5
A Unable to pass batch file arguments unaltered Support 18
MikeBaas How to...extract a string from a .json-file? Support 10
vefatica LIBRARY and file name completion? Support 4
D What does the file "..\Everything\Run history.csv" store? Support 5
H Takecommand.pdf failed not a pdf file Support 6
Joe Caverly DIRectory Colorization in v25 Help File Support 0
C show file description? with dir? Support 8
D When copying/moving, appending " (2)" to filename when the target file already exist. Support 7
R How to? Dir specific file search patterns with spaces in the pathnames? Support 6
Joe Caverly _EXPANSION in help file Support 0
Stefan Hassel Installation file TC 24.02 Build 47 is actually version 25.00.1 Support 10
vefatica Are @FILEDATE[file] and @FILEDATE[file,u] ever different? Support 2
K_Meinhard Help file error Support 1
Joe Caverly JOBMONITOR in Help File Support 1
D btm file command line augments comparing for string or math. Support 12
A Documentation [Help file] OPTION "//" synopsis formatting issue Support 0
vefatica Can TCC complete this file name? Support 5
G tcedit ist not run in tc 24 file explorer Support 10
M How to set Path variable for non-executable file extensions in 4DOS Support 8
I zip /M fails to delete file after adding to zip file Support 2
Charles Dye Is the "File Associations" installer dialog working? Support 4
J File explorer handling from command line? Support 2
Joe Caverly v24 Help File - DATEMONITOR Support 1
MickeyF Why does this batch file give me 'unknown command "else"' error? Support 17
vefatica TYPE goes crazy with no-BOM Unicode file Support 7

Similar threads