View Single Post
Old 07-02-2009, 08:27 AM   #2 (permalink)
Stu_computer
Tech Hardware Team
 
Stu_computer's Avatar
 
Join Date: Jul 2005
Posts: 1,462
OS: Windows


Re: Executing .bat file in multiple subdirectories

for /F "usebackq delims=" %k IN (`dir *.tif /s /b`) DO @echo %~dpnk

here i just @echoed it to the display, try it at the command prompt and it looks like doing a fancy dir *.tif and will also show all the subdirectory contents too.

so in example if i was using irfanview (which, by the way, does batch conversion etc) to process a directory tree of tif files, like your doing, then i would use it's command line version like this...

for /F "usebackq delims=" %k IN (`dir *.tif /s /b`) DO c:\program files\i_view32.exe %~dpnk /convert=%~dpk\*.jpg
(not exactly correct, would have to tell iview it's getting a tif extension, but you get the idea).

so, up to you whether you use it directly or call the next batch file.

%k (full path)
%~dpnk (path, no extention)
%~dpk (only shows directories part that have k files but not filenames)
__________________
Stu_computer is offline   Reply With Quote