Hello,
I want to create a bat file with which a specific action will be performed under all the subfolders of a certain path.
I have already made a file with which I can execute my action under a specific folder(C:\IPSL\T125\LM55786_UUS\SIPSTK\PARSING_MIDDLE\PARSING_MIDDLE10\main) individually:
echo off
cd C:\IPSL\T125\LM55786_UUS\SIPSTK\PARSING_MIDDLE\PARSING_MIDDLE10\main
del *.ITS
del *.TRC
del *.dbc
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.ctl"
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.scr"
echo
pause
The script above works fine but just for the files under the specific folder "PARSING_MIDDLE10\main".
What I need is this actions to be performed to all subfolders under "C:\IPSL\T125\LM55786_UUS\SIPSTK\PARSING_MIDDLE\".
I have modified the bat file as below but it does not work
echo off
cd C:\IPSL\T125\LM55786_UUS\SIPSTK\PARSING_MIDDLE\
for /r %%g in (.) do
del *.ITS
del *.TRC
del *.dbc
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.ctl"
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.scr"
echo
pause
Any idea;
Thanks
Nikos
File process under each subfolder of a certain path
Moderator: DosItHelp
-
- Posts: 19
- Joined: 01 Mar 2013 11:44
Re: File process under each subfolder of a certain path
Try this but backup your files first.
Code: Select all
echo off
for /d /r "C:\IPSL\T125\LM55786_UUS\SIPSTK\PARSING_MIDDLE" %%g in (*) do (
pushd "%%g"
echo "%%g"
del *.ITS
del *.TRC
del *.dbc
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.ctl"
ipslc /B /p%toolpath%\ipsl\sip01\sip01.prf -cits -m "*.scr"
popd
)
echo done
pause
-
- Posts: 19
- Joined: 01 Mar 2013 11:44
Re: File process under each subfolder of a certain path
Hello foxidrive,
This works...
Thank you very much!!!
Nikos
This works...
Thank you very much!!!
Nikos