0

Hi all i am a noob to programming (in practice) have done some courses though, and i apologise in advance if i am wasting your time with my problem.

I would like to process images using a batch file that i have made already, the problem is i need to process 100+ images using their file name as an input and would like to know how to make this possible?

my script looks like this

@echo on
echo file name convention:M02-ASCA-ASCSMR02-NA-3.2-20140129081200.000000000Z-1095218.bfr
echo test from UMARF
echo note orbit number as %9
rem set orbitnumber=%9


set longfilename= %filename% 
rem: shorfilename1=yyyymmdd
set shortfilename1=%longfilename:~26,12%
echo shortfilename1
pause
set PATH=%D:\geonetcast\Software\ILWIS\Ilwis372_oct2012\Extensions\GEONETCast-Toolbox\util%
call 7z.exe e %longfilename%.bz2
pause
echo on
set PATH=%D:\geonetcast\Software\ILWIS\Ilwis372_oct2012\Extensions\GEONETCast-Toolbox\util%
pause

rem: Ascat surface soil moisture
rem: in top 5 cm of soil
rem: output point map is estimate of water saturation from 0-100%


set VBUFR_TABLE_DIR=D:\geonetcast\Software\ILWIS\Ilwis372_oct2012\Extensions\GEONETCast-Toolbox\util\tables
set VBUFR_DATA_DIR=D:\test


call bufrtool.exe pick %longfilename% 6001 5001 40001 40002 40003 40007 > D:\test\%shortfilename1%_org.txt

call deletelines.exe D:\test\%shortfilename1%_org.txt D:\test\%shortfilename1%_imp.txt 7
copy D:\geonetcast\Software\ILWIS\Ilwis372_oct2012\Extensions\GEONETCast-Toolbox\util\asc.dm# 
copy D:\geonetcast\Software\ILWIS\Ilwis372_oct2012\Extensions\GEONETCast-Toolbox\util\asc.dom %shortfilename1%.dom

set PATH=%D:\geonetcast\Software\ILWIS\Ilwis372_oct2012%
call ilwis.exe -C D:\test\%shortfilename1%.tbt:=table(D:\test\%shortfilename1%_imp.txt,Space,Convert,none,ID(D:\test\%shortfilename1%.dom{id}),X(value.dom{-180:180:0.00001}),Y(value.dom{-90:90:0.00001}),SM_perc(value.dom{0:100:0.01}),Error_perc(value.dom{0:100:0.01}),Mean_SM(value.dom{0:100:0.0001}),Quality(value.dom{0:100:1}));
call ilwis.exe -C D:\test\%shortfilename1%_smperc.mpp:=PointMapFromTable(D:\test\%shortfilename1%,LatlonWGS84,SM_perc);
rem

end

(i know a tad long)- i have searched for a solution i can use but am struggling at present, I found this code on another site but can't get it to work for my itteration,

FileList = dir('*.csv');
N = size(FileList,1);

for k = 1:N

   % get the file name:
   filename = FileList(k).name
   disp(filename);

   % insert your script code here

would really appreciate some help.

Regards J-bon3

2 Answers 2

1
For %A in (c:\windows\*.ini) do echo %A

In a batch file you use %%A rather than %A at a command prompt. See

for /?

You can also see

forfiles /?
Sign up to request clarification or add additional context in comments.

Comments

1

If you have the list of the files in a file. Like this :

FileList.txt :

File1.xxx
File2.xxx
File3.xxx
File5.xxx

You can use a simple FOR loop with a CALL to do what you want :

@echo off
for /f "delims=" %%a in ('type filelist.txt') do call:Work %%a
Echo Done ...
exit/b

:work
set $file=%1
echo Treating File : [%$file%]

Output :

Treating File : [File1.xxx]
Treating File : [File2.xxx]
Treating File : [File3.xxx]
Treating File : [File5.xxx]
Done ...

2 Comments

The file is represented in the VAR %$file%
@tony_bd thanks for the assistance it works well, i went with sacha's method it saved me hours of work...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.