|
Answer» First I don't know how to get files from a txt by the way i want . I got my mp3s in a folder and i want to MAKE a BAT to list them and sort them by A to Z . Here's a simple example:
Artist - Song0.mp3 Artist - Song1.mp3
I want the created txt to looks like that:
Artist - Song0;FORMAT .mp3
The question is that:
How to list the files and after that to make the program to get specific line from the first created txt with listed files ... the other thing is easy ? I don't get it how to make the program to copy the songs in the new txt line by line from the prevuous document ! Please tell me that you get it what I mean . P.S. I don't want to make the program for me , just tell me a tip and give me an advice how to do it .
Code: [Select]for /f "delims=" %%a in (a.txt) do echo %%~na;format %%~xaOk I get it most of the part , could you explain what this cmds do ? I want to understand how things works ! I know the BASIC , and I understand most of the part of the script , but you may put some description , I'm a newbie in this . %%~na - name of file %%~xa - ext of file
everythink is explained in cmd help
use
Code: [Select]for /?I've change everything (the player that I use) and now have a problem .
Code: [Select]:welcome cls echo off echo Welcome set filetocheck=myplaylist.txt
:check echo Looking for myplaylist.txt file ... ping -n 1 -w 1500 1 >nul cls if exist %filetocheck% GOTO :clearlist if not exist %filetocheck% goto :program
:program cls echo Locate the folder with MP3 files: set /p mp3dir= echo You set dir to: %mp3dir% ping -n 1 -w 1500 1 >nul cls dir /s /b /od *.mp3 >> data for /f "delims=" %%a in (data) do echo "<item>"%%~xna;%%~na"</item>" >> myplaylist.txt del data echo Please wait a second ... ping -n 1 -w 1500 1 >nul cls echo Finish ! ping -n 1 -w 1500 1 >nul goto exit
:exit exit
:clearlist echo NOTE: myplaylist.txt , do you want to delete it ? echo Use (Y) for "YES and (N) for "NO" and press enter . set /p ans= if .%ans%==.y goto dellist if .%ans%==.Y goto dellist if .%ans%==.n goto program if .%ans%==.N goto program cls
:error echo error: Use (Y) for "YES" and (N) for "NO" for an anwser ! ping -n 1 -w 1500 1 >nul cls goto welcome
:dellist del myplaylist.txt goto welcome This line have symbols that can exist there ...
Quote for /f "delims=" %%a in (data) do echo "<item>"%%~xna;%%~na"</item>" >> myplaylist.txt
and I need this code , but when I remove " symbol the batch won't run because THINKS that is some command .
Any ideas how to remove the " and to keep code in front the filenames and at the end of the filenames now ?
Example: Artist - Song.mp3;Artist - Song
If there have a way to remove this symbol " from every line in the TXT file , everything will be ok then !
Quotefor /f "delims=" %%a in (data) do echo ^<item^>"%%~nxa;%%~na"^</item^> >> myplaylist.txt
That's works now , thanks to everyone who helped me .
Code: [Select]for /f "delims=" %%a in (data) do echo ^<item^>^%%~xna;%%~na^</item^> >> myplaylist.txt
|