4
I want, with a batch file, to be able to search and display the files in a bunch of folders called "error" located in a bunch of different places.
The error folder is always at the same folder depth but the folder names befor them is different.
dir /A-d /b C:\Temp\*random_folder_name*\*random_folder_name*\error
So, can I create a line that displays all the files in all the error folders, two folders "below", in this example "C:\Temp"? or do I have to add one dir line for every error-folder?
Are you sure? That last regex looks incorrect. Why are you escaping
(
,)
,{
, and}
? – dbenham – 2014-08-27T02:11:51.953Yes I'm sure I've actually tested all of these on my system. Trust me, those characters need escaped. It won't work without it. – krowe – 2014-08-27T02:55:44.550
Sorry, I'm used to using JavaScript regex. That is a very curious design choice for grep. Most meta characters are escaped if you want to treat them as a literal. But in grep, some literal characters are "escaped" to turn them into meta characters. That is crazy! – dbenham – 2014-08-27T11:21:33.253
That gave me an idea: https://gist.github.com/krowe/da2a6b021ac891f8e3be
– krowe – 2014-08-27T12:58:22.867Yes, hybrid scripting is a powerful way to extend batch capabilities. I have created a different but related JScript/batch utility called REPL.BAT. It has been incredibly useful for many problems that are difficult to solve with pure batch.
– dbenham – 2014-08-27T16:51:15.257I hadn't realized that you wrote that. I've used that before as well and only a few moments ago realized that it was using the same technique. – krowe – 2014-08-27T16:57:30.750