DOS CMD Sort+Add Sequence+Remove Sequence number

May 13, 2017

I want to edit a folder with 3500 .wma music files(records). Can someone please give me the exact DOS CMD Commands to -
a) Sort the folder alphabetically
b) Add a Sequence number in front of each music record's filename
(at this point I want to edit the folder's records - remove, repair and load back the one's with problems)
c) Remove the Sequence numbers

Thank-you very much

May 20, 2008
Syracuse, NY, USA
What operating system? ... what file system (NTFS?) ... are all the files in **one** directory (without subdirectories)? ... what will the numbers be used for?
May 13, 2017
Hi vefatica

Thanks for responding. I am using Windows 10 Pro, NFTS filing system, and there are masses of sub-directories, which I am busy to remove - cut & pasting all records to a single directory. Eventually I would break them up in Classical; Light Classical; Opera; Vocal; Popular; etc (maybe 10 to 20 sub-directories), after I have fixed the problems.

As I mentioned in a previous thread (May 2017), for some or other reason some of the .wma records don't play on the music system of my Honda Civic ("Not Playable"), so I need to easily identify the culprits, because it just flashes on the display screen, then it goes on to the next record. If every record is numbered, it would be easy to jot down the culprits.


May 13, 2017
If the DOS CMD Command to remove the sequence numbers can also be used to remove all digits in the front of all filenames it will be great, because at the moment I have to remove it manually (inserted as track numbers when loading LP's to my computer by MAGIX app). The few valid digits like "1812 Overture" I can reload manually.
May 20, 2008
Syracuse, NY, USA
I have no idea how (or even IF) what you want can be done with CMD. Here are a couple straightforward BTM files (for TCC.EXE) to add and remove the numbers (and an example of their use). I'd be very surprised to see something like that done with CMD. Sorting should not be an issue if you have NTFS; NTFS returns filenames in alphabetical order.
May 13, 2017
Thank-you vefatica, MaartenG and JohnQSmith. I'm not too smart on software, so it will take me a time to experiment to get a workable solution.
Will let you know when there is a positive result.
Nov 2, 2008
wren.exe does a pretty good job on this. It comes in MS-DOS and Win32 modes.

In the example above, you would use ' wren *-*.wma $3.wma' The $1, $2, ... match individual wildcards or strings.

WRen by Jason Hood <>.
Version 1.02 (9 October, 2003). Freeware.

WREN [-acdFt] [old_path]old_pattern [[new_path]new_pattern]

        -a      all files (include hidden and system files)
        -c      match case
        -d      include directories
        -F      force rename (delete existing files)
        -t      test (display instead of rename)
        -u      undo the previous rename
        -h      help
Similar threads
Thread starter Title Forum Replies Date
Z [dos] into - for loop - the bp is not hit Support 5
T Regex engine doesn't recognize native DOS line endings Support 2
A CDD and DOS filenames Support 1
vefatica _DO_LOOP and nested DOs? Support 8
Joe Caverly How to? Run DOS .exe's the same way Wine does... Support 3
T Associating BTM files with IDE results in DOS box Support 33
vefatica Single-line DO inside nested multi-line DOs? Support 9
D tcmd 12 and DOS Support 4
R DOS programs Support 4
M Ansi.sys and old Dos programs Support 7
B TCC 11 & Windows 7 64bit & DOS apps? Support 6
M Invoking a DOS command within a C++ program Support 1
epement Coerce DOS programs to handle LFN Support 0
T WAD CMD incompatibility Support 14
sully9 How to? Unexpected %DATE% CMD variable format (vs DATE /T format) in CMDebug Support 1
L FTYPE in TCC, less quirky than in cmd.exe Support 3
Peter Murschall Single-line Do-CMD is a bit uncooperative. Support 6
FreezerBurnt Help making a CMD and TCC compatible batch file Support 7
T Date format date different from cmd Support 7
D Differences between TCC and CMD with COPY /b Support 4
M Oracle batch OPatch.bat.bat not working in TCC but correctly in CMD Support 5
E TCC/CMD difference Support 5
S How to? Deinstalling TC/reinstating execution of bat files by cmd in Win7 Support 31
D How to? Pass OpenHere Folder to CMD? Support 6
R Difference between TCC and CMD: variable names with hyphens Support 4
M WAD "Pictures" directory is empty in TCC but not in CMD or Explorer Support 4
rps Cmd history recall Support 4
rps Documentation TITLE cmd docs Support 0
Joe Caverly PUSHD with UNC path in CMD.EXE Support 2
W Starting program for word to pdf conversion (difference cmd and tcc) Support 13
Joe Caverly Using this CMD technique from TCC Support 17
W If command - different with CMD Support 6
I how to make TCC default/replace cmd.exe? Support 9
R FOR usage error from TCC but not from CMD Support 16
I findstr works in cmd but not in tcc Support 5
D Pasting Unicode data has different behavior on TCC and CMD Support 2
M Command line parsing differences between cmd.exe and TCC Support 6
Joe Caverly Works with CMD.EXE, no output with TCC.EXE Support 7
Joe Caverly tcommand(cmd) Support 13
L WAD ECHO. expansion of non-existent env-vars differs from CMD.exe Support 6
Joe Caverly "Functions" in cmd.exe batch files Support 6
Joe Caverly Works in debugger, not from cmd line Support 1
K CMD, TCC, VisualStudio 2017, VcVars* differences Support 1
D Does TCC improve CMD's implementation of ECHO? Support 6
P Labels in batch files: TCC vs CMD.exe Support 9
Patulus Yet another thread on CMD compatibility Support 16
A Fixed (CMD compat) START /D fails to recognize the switch option. Support 3
Joe Caverly CMD.EXE and filename(1).ext Support 3
T WAD Difference between TCC and CMD in handling multi-command lines Support 6
C Nested IF syntax — TCC behaving differently to CMD Support 12

Similar threads