Read, parse, then write to a file

Home Forums Scripting DOS Command Shell Read, parse, then write to a file

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    graffixx
    Member
    #161383

    I have to need to read in a filename from each sub folder, find a string I am looking for, then write to a text file. The filename from each sub folder is always the same.

    I use “find” to look for the string. This is what I have…


    @ECHO
    OFF

    SET filename=metadata.txt

    FOR /F %%D in (‘dir /b /a:D’) DO (

    (find /i “” “%%D%filename%”)
    (find /i “” “%%D%filename%”)<br /> (find /i “<track_number>” “%%D%filename%”)</p> <p>)<br /> [/CODE]</p> <p>How do I assign variables for “artist_name”, “title”, and “track_number”, then echo/print each variable to a file so that the result looks like</p> <p>artist_name, title, track_number (comma delimited, for example)</p> <p>Thanks in advance![CODE]<br /> <a href="https://petri.com/forums/users/echo" class="bbp-user-mention bbp-user-id-128498""><br /> @ECHO</a> OFF</p> <p> SET filename=metadata.txt</p> <p>FOR /F %%D in (‘dir /b /a:D’) DO (</p> <p>(find /i “<artist_name>” “%%D%filename%”)<br /> (find /i “<title>” “%%D%filename%”)<br /> (find /i “<track_number>” “%%D%filename%”)</p> <p>)<br /> [/CODE]</p> <p>How do I assign variables for “artist_name”, “title”, and “track_number”, then echo/print each variable to a file so that the result looks like</p> <p>artist_name, title, track_number (comma delimited, for example)</p> <p>Thanks in advance!</track_number>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.