i have a directory which contains the following:
-directory
-another directory
-meta.xml
-yet another directory
-meta.xml
...
So it needs to find in every directory ‘meta.xml’, all by itself (so that i dont have to type in every directory at the code) And i want that with EVERY meta.xml file a command is done.
Is there ANY possible way to do this, and could this be quiet done because the command i was talking about gives a text line from that meta.xml file, and i would like to not see whats its doing, that you get something like this:
text from meta file 1
text from meta file 2
text from meta file 3
and not
meta.xml found
text from meta file 1
meta.xml found
text from meta file 2
meta.xml found
text from meta file 3
If thats not clear, just think that i would just to like it run quietly, ok. (/Q maybe?)
this is the command i was talking about:
findstr "<name>" meta.xml >temp1.lis
FOR /F "tokens=2 delims=>" %%i in (temp1.lis) do @echo %%i > temp2.lis
FOR /F "tokens=1 delims=<" %%i in (temp2.lis) do @echo %%i > temp3.lis
it needs to do this for every single meta.xml file and giving the output so you get a total list when you do
type temp3.lis
Thanks!
Ok, as far as I can tell, this should work:
findmeta.cmd
I modified your script part so answers are added to temp3.lis, instead of replacing it, and removed the use of the first temp file.
If, in the end, what you’re looking for is what ever is between the tags, like
<name>blahblah</name> (the blahblah part)this should do even faster, no temp files needed and one less for loop (broke into multiple lines for ease of reading, it all hold on a single line if needed.
Single line version:
Not sure which you prefer, IF this is what you’re looking for.
EDIT:
Ok I think I got it, but I’m not sure it’s gonna fix everything. Basically you want to change the tokens=2 to tokens=3 like this:
Now see if this works.