View unanswered posts | View active topics It is currently 23 Oct 2014 14:37



Post new topic Reply to topic  [ 10 posts ] 
Reading from 3 files to create a command... 
Author Message

Joined: 04 Apr 2012 03:11
Posts: 38
Post 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?


13 Apr 2012 04:26
Profile

Joined: 23 Dec 2011 13:59
Posts: 1936
Post 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


13 Apr 2012 06:02
Profile
Online

Joined: 10 Feb 2012 02:20
Posts: 4320
Post 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.


13 Apr 2012 06:27
Profile

Joined: 23 Dec 2011 13:59
Posts: 1936
Post 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! :lol:


13 Apr 2012 06:50
Profile
Online

Joined: 10 Feb 2012 02:20
Posts: 4320
Post Re: Reading from 3 files to create a command...
:) maybe there is a simpler way.


13 Apr 2012 07:31
Profile

Joined: 04 Apr 2012 03:11
Posts: 38
Post 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?


13 Apr 2012 08:20
Profile
Online

Joined: 10 Feb 2012 02:20
Posts: 4320
Post 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

Code:
@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:
@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
)
)
)


13 Apr 2012 09:11
Profile

Joined: 04 Apr 2012 03:11
Posts: 38
Post Re: Reading from 3 files to create a command...
I'll try it when i get home tonight!

Thanks Foxi... ;)


13 Apr 2012 10:17
Profile
Expert

Joined: 06 Dec 2011 22:15
Posts: 734
Location: México City, México
Post 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:
echo(!line!
.. by this one?
Code:
echo(!line!"


13 Apr 2012 18:13
Profile
Online

Joined: 10 Feb 2012 02:20
Posts: 4320
Post 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?


15 Apr 2012 02:38
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Forum style by Vjacheslav Trushkin for Free Forums/DivisionCore.