Reading from 3 files to create a command...
Moderator: DosItHelp
-
- Posts: 38
- Joined: 04 Apr 2012 03:11
Reading from 3 files to create a command...
Hi guys,
In a similar vein to a previous query that i had i've got a situation where i need to read information from 3 files to build a command to be run...
The three files contain pathnames on different lines and i simply need a loop to call the whole line of data from each of the files and echo it out to the following command:
file1.txt = %var1%
file2.txt = %var2%
file3.txt = %var3%
each file has a the same amount of entries in it and i need to be able to loop through every line in them whilst using the data in the following command...
echo shntool split "%var1%" -f "%var2%" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "%DRIVE%\OJW\TEMP\%var3%"
The other problem i have is when trying to echo out the command is that the bit that reads "%%p - %%t" dosnt show up in the echo ...
Any ideas?
In a similar vein to a previous query that i had i've got a situation where i need to read information from 3 files to build a command to be run...
The three files contain pathnames on different lines and i simply need a loop to call the whole line of data from each of the files and echo it out to the following command:
file1.txt = %var1%
file2.txt = %var2%
file3.txt = %var3%
each file has a the same amount of entries in it and i need to be able to loop through every line in them whilst using the data in the following command...
echo shntool split "%var1%" -f "%var2%" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "%DRIVE%\OJW\TEMP\%var3%"
The other problem i have is when trying to echo out the command is that the bit that reads "%%p - %%t" dosnt show up in the echo ...
Any ideas?
Re: Reading from 3 files to create a command...
Like I posted in your last thread.
The very first set of code in this thread is what you would use.
viewtopic.php?f=3&t=3126
The very first set of code in this thread is what you would use.
viewtopic.php?f=3&t=3126
Re: Reading from 3 files to create a command...
If you describe how you create file1/2/3 then maybe other ideas can be used.
Re: Reading from 3 files to create a command...
foxidrive wrote:If you describe how you create file1/2/3 then maybe other ideas can be used.
Kind of like your last post!
Re: Reading from 3 files to create a command...
maybe there is a simpler way.
-
- Posts: 38
- Joined: 04 Apr 2012 03:11
Re: Reading from 3 files to create a command...
Lol ... I'm 99% of the way there... although im sure this could be a LOT cleaner!
@echo off
setlocal EnableDelayedExpansion
dir /s /b c:\ojw\temp\ape\*.wav >c:\ojw\logs\APE_fullpath.txt
dir /s /b c:\ojw\temp\ape\*.cue >c:\ojw\logs\APE_cuefullpath.txt
dir /b c:\ojw\temp\ape >c:\ojw\logs\APE_albumfoldername.txt
3<c:\ojw\logs\APE_cuefullpath.txt 4<c:\ojw\logs\APE_albumfoldername.txt (
for /F "delims=" %%a in (c:\ojw\logs\APE_fullpath.txt) do (
set line=
set /P line=c:\ojw\tools\shntool.exe split "%%a" -f <&3
set /P line= ""!line!" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "c:\ojw\completed_album\ape\<&4
echo(!line!
)
) >c:\ojw\logs\diditwork.txt
Now....The reasen it's only 99% there and not 100% is this...
The above bit of code generates the following command for me:
c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar
The only problem is... It needs to be like this ...
c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar"
*** The only difference is the quote mark on the VERY end of the command!!! ***
I just cant seem to get it in there!! Everything i do IGNORES the quote at the end!
Ideas?
@echo off
setlocal EnableDelayedExpansion
dir /s /b c:\ojw\temp\ape\*.wav >c:\ojw\logs\APE_fullpath.txt
dir /s /b c:\ojw\temp\ape\*.cue >c:\ojw\logs\APE_cuefullpath.txt
dir /b c:\ojw\temp\ape >c:\ojw\logs\APE_albumfoldername.txt
3<c:\ojw\logs\APE_cuefullpath.txt 4<c:\ojw\logs\APE_albumfoldername.txt (
for /F "delims=" %%a in (c:\ojw\logs\APE_fullpath.txt) do (
set line=
set /P line=c:\ojw\tools\shntool.exe split "%%a" -f <&3
set /P line= ""!line!" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%p - %%t" -d "c:\ojw\completed_album\ape\<&4
echo(!line!
)
) >c:\ojw\logs\diditwork.txt
Now....The reasen it's only 99% there and not 100% is this...
The above bit of code generates the following command for me:
c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar
The only problem is... It needs to be like this ...
c:\ojw\tools\shntool.exe split "c:\ojw\temp\ape\Anthrax (ape).rar\CDIMAGE.wav" -f "c:\ojw\temp\ape\Anthrax (ape).rar\CUE\B52 - FUNPLEX.cue" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%p - %t" -d "c:\ojw\completed_album\ape\Anthrax (ape).rar"
*** The only difference is the quote mark on the VERY end of the command!!! ***
I just cant seem to get it in there!! Everything i do IGNORES the quote at the end!
Ideas?
Re: Reading from 3 files to create a command...
Try this and see what is produced in testrun.bat.txt
Run it in c:\ojw\temp\ape\ folder
This one might remove the entries files where a cdimage.wav doesn't exist.
Run it in c:\ojw\temp\ape\ folder
Code: Select all
@echo off
del testrun.bat.txt 2>nul
for /f "delims=" %%a ('dir *.cue /b /s') do (
for /f "delims=" %%b ("%%~dpa\..") do (
echo c:\ojw\tools\shntool.exe split "%%~dpb\cdimage.wav" -f "%%a" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%%%p - %%%%t" -d "%%~dpb">>testrun.bat.txt
)
)
This one might remove the entries files where a cdimage.wav doesn't exist.
Code: Select all
@echo off
del testrun.bat.txt 2>nul
for /f "delims=" %%a ('dir *.cue /b /s') do (
for /f "delims=" %%b ("%%~dpa\..") do (
if exist "%%~dpb\cdimage.wav" (
echo c:\ojw\tools\shntool.exe split "%%~dpb\cdimage.wav" -f "%%a" -m \-/-*-£-$-=-+-¬-`-¦-;-:-@-'-#-~- -t "%%%%p - %%%%t" -d "%%~dpb">>testrun.bat.txt
)
)
)
-
- Posts: 38
- Joined: 04 Apr 2012 03:11
Re: Reading from 3 files to create a command...
I'll try it when i get home tonight!
Thanks Foxi...
Thanks Foxi...
Re: Reading from 3 files to create a command...
phoenix_Rising wrote:*** The only difference is the quote mark on the VERY end of the command!!! ***
I just cant seem to get it in there!! Everything i do IGNORES the quote at the end!
Ideas?
Did you tried to change the ending
Code: Select all
echo(!line!
Code: Select all
echo(!line!"
Re: Reading from 3 files to create a command...
phoenix_Rising wrote:I'll try it when i get home tonight!
Thanks Foxi...
Did it work?