Saturday, 7 September 2013

Asking help updating batch parser

Asking help updating batch parser

I have a question about the following batch file: it does it's work
perfectly but i'm wondering if the following is possible:
Is there any way for it to let it look in several directories and output
the file in that specific directory and then continues to the next until
it reached the end of the directory list and then finishes.
So for example:
main dir -subdir
-subdir1
-subdir2
-ect.
i start the batch in maindir and it will list the files each subdir in an
outputfile.rss in that subdir. so it will look like this:
main dir -subdir - outfile.rss (contains the list of files of this subdir)
-subdir1- outfile.rss (contains the list of files of this subdir)
-subdir2- outfile.rss (contains the list of files of this subdir)
-ect.
And this is the batch file i would like to "expand". Hopefully someone can
help me with this?
@ECHO OFF &SETLOCAL
SET "header1=<rss version="2.0" xmlns:jwplayer="http://rss.jwpcdn.com/">"
SET "header2= <channel>"
SET "footer1= </channel>"
SET "footer2=</rss>"
(
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO(!header1!
ECHO(!header2!
ECHO(
ENDLOCAL
FOR %%a IN (*.flv *.mp4) DO (
ECHO( ^<item^>
ECHO( ^<title^> %%~na ^</title^>
ECHO( ^<jwplayer:source file="/temp/records/%%~nxa" /^>
ECHO( ^</item^>
)
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO(
ECHO(!footer1!
ECHO(!footer2!
)>outfile.rss
Thanks in advance.

No comments:

Post a Comment