Author Topic: appending text to a dir > output command????????  (Read 1778 times)

Space Between

  • Guest
appending text to a dir > output command????????
« on: October 04, 2002, 03:18:27 AM »
What i want to do is exactly is run Lame.exe to encode .mp3\'s off my drive

i would place the .bat file in the root of the drive with my .wav files and run it...it would then find all the .wav files and encode them

dir /b /s /d *.wav > mp3_temp.bat

that woudl find them all and output them path\'s to mp3_temp.bat

now i want to also put in that same mp3_temp.bat file the words       Lame --r3mix     before the path of the .wav files

for it to look like this in the final .bat what it will be

Lame --r3mix c:backandforthigomusic.wav

rignt now it only looks like

c:backandforthigomusic.wav

i need to append Lame --r3mix or set a variable some how

ive tried what doesn\'t work...like

set lame=c:lame.exe
set opts=--r3mix
set lame=%lame% %opts%

for %%p in (mp3_temp.bat) do %lame% %%p

this doesnt work..ive also tried     FIND /i \".wav\" mp3_temp.bat    and tried to do somethign with that but no go.

i know it can be done because i have had .bat files that have done it...but that was a long time ago...o how i wish i would of kept those handy

Anonymous

  • Guest
appending text to a dir > output command????????
« Reply #1 on: October 04, 2002, 06:57:26 AM »
dude, just open the file in notepad, if you have it, and do a find/replace for the text c: and replace it with lame --t3mix c: and that should add what you need before every file. hope this helps, I had to do this for an rar file I use that will make win98 use winme files so I get the stability of win98 but with the newest additions of winme.

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #2 on: October 04, 2002, 03:09:51 PM »
thanks but your missing the point...i can\'t due that in a batch file...atleast i have no idea on how to find and replace text in dos batch mode...any clue\'s?

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #3 on: October 04, 2002, 03:14:22 PM »
you would think between the for %%p with shift, dir, find, and echo command...using all these to create temporary .bat files and variable\'s it would be alot easier... but it\'s now

Evilvoice

  • Guest
appending text to a dir > output command????????
« Reply #4 on: October 04, 2002, 04:54:43 PM »
Im saying take out the variables, and you can edit a batch file, just open it in notepad, the only difference is you would always have to do this, but it only takes like a second, just do a find and replace in notepad change \"c:\" to \"lame --r3mix c:\" (without quotes).  If you use the dir command to create the batch file, then once that is done, open it up in notepad (open notpad, open-all files- mp3_temp.bat) and do a find/replace for that text.  then, when you goto save it type this exactly in (with quotes) \"mp3_temp.bat\" and notepad wont add the .txt extension, then run the file, simple.  but kill the variables.  if you want, I could give you an address to send the bat file to and ill do it.

Evilvoice

  • Guest
appending text to a dir > output command????????
« Reply #5 on: October 04, 2002, 04:57:13 PM »
oh wait, youre doing this strictly in dos or a dos window, if its a dos window, just goto where you saved the batch file, prolly c: or something like that, its be whatever dir you typed dir /s/... in if youre doing this in strictly DOS (no windows) the use dosshell, i am pretty sure find replace is in there :-)

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #6 on: October 06, 2002, 01:27:22 AM »
Find and replace is not in the the FIND command\'s parameter\'s...or the ECHO\'s...as far as i understand it should be possible. Either using the line numbers and setting it to find each line and replace \"c:\" with \"Lame --r3mix c:\" by calling the name of another batch file\'s name...which would be \"Lame --r3mix.bat\" or soemthign

i know it can be dnoe...just not knowing how is the problem

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #7 on: October 08, 2002, 10:43:56 PM »
i got to bump this one up...it\'s turn from something that was just something to try...to a crital piece of information...im goning to use this for WAY more than just .mp3\'s

Anonymous

  • Guest
appending text to a dir > output command????????
« Reply #8 on: October 08, 2002, 11:46:33 PM »
I would have thought you would have tried >> by now...

ViperZ2000

  • Guest
appending text to a dir > output command????????
« Reply #9 on: October 11, 2002, 05:52:31 PM »
Do a search on google for a program called \"Mini True\" or \"MiniTrue\".  It is a dos based search and replace. I use it often. It can be launched via a batch file with switches to search for and replace just about any kind of text in a file.

Hope this works for you.

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #10 on: October 11, 2002, 11:24:13 PM »
im sorry i mean prefixing...not appeding.

cjwj

  • Guest
appending text to a dir > output command????????
« Reply #11 on: October 13, 2002, 05:47:31 AM »
Unix has support for much more advanced shell-scripting.  Cygwin includes nearly all of the unix tools including sed, which could be used for this.  Cygwin is available from cygwin.com, though if you don\'t want all of it you can probably find a DOS port of sed.

Anonymous

  • Guest
appending text to a dir > output command????????
« Reply #12 on: October 15, 2002, 10:57:34 AM »
for /r c:  %%f in (*.wav) do Lame --r3mix %%f

I know it works for nt/2000/xp command ext. enabled.
Dont know about 9x/me.

You alson need to specify output dir with lame cause i
don\'t know where it put the final mp3s

Anonymous

  • Guest
appending text to a dir > output command????????
« Reply #13 on: October 15, 2002, 12:40:00 PM »
Hi,
 Try
del myBat.bat
for %%i in (anyPath*.wav) do echo Lame --r3mix \"%%i\" >> myBat.bat

Thanks

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #14 on: October 16, 2002, 02:05:26 AM »
Damn damn damn close...very close.

Thanks for the advice from you 2 anon\'s above...it\'s helping ALOT.

Here\'s the deal though..im trying to scan all the subdirectories of the directory this .bat is executed, find all the .wav file\'s using the dir command and pass this with lame --r3mix in front of it...but this is REAL close

running the command of

@echo off
dir /b /s /d *.wav ? mp3_temp.bat
for /f %%i in (mpe_temp.bat) do echo lame --r3mix \"%%i\" >> workdamit.txt

running that will give me this result....notice it cutting off after a space in a dir name

lame --r3mix \"C:files!project\'sLameBatch1.wav\"
lame --r3mix \"C:files!project\'sLameBatchCopy\"
lame --r3mix \"C:files!project\'sLameBatchCopy\"
lame --r3mix \"C:files!project\'sLameBatchCopy\"

now see there is more folders...named copy of a folder with a 2.wav in it...and another directory in that folder containg 3.wav

but it is working partially...it obviously is using the mp3_temp.bat to search through and use ...but cutting off at a space in the directory name...this is a not a 8.3 issue obviously since these folders contain more than 8 characters.

realy rreally really close...dam close. if i could get it to use exactly what is in the mp3_temp.bat instead of just reading it and quitting when it first see\'s a space this would now work....all i would have to due is set delims on the \"\'s and im guessing if i got that worked out this would roll perfectly.

thanks for the help soo far...getting alot out of this...i am atleast

Anonymous

  • Guest
appending text to a dir > output command????????
« Reply #15 on: October 18, 2002, 01:15:04 PM »
Hi,
  Is there a reason why you need to generate mp3_temp.bat?  My post, 10/15/02 12:40 PM, will work on any directory.  By the way, you can use
for /f \"delims=\" %%i in ...

Thanks

Space Between

  • Guest
appending text to a dir > output command????????
« Reply #16 on: October 18, 2002, 10:48:58 PM »
actually it only works on directories without spaces...i think, but cant seem to figure out, if i open up a 16bit \"command\" inside the batch file it might work. On my win2k system the normal 32bit will stop at the first space in a directory name. i dont know if i can include ALT040 in it to recongize the spaces or not...i have no clue at all if i can due that to see space\'s in folders...i only know it works at the 1st character in each line....it doesnt want to work on the space\'s in the folder names however.

yeh the delims will work to get ride of all the \"\" marks i imagine...but if the whole path is not there then no good.

im only doing this now to see if it can work...i will however use it with lame. I have another batch file that i managed to get off of alt.msdos.batch that allows a user to input something to store into a variable...so i am 50% complete on making a batch file that will allow the user to input ID3 tag\'s...but still if it cant find all the files then no good.

im also using sort with the | pipe command to sort everything out before the command is ran. also right now im tinkering with inserting lines between each path name that have \"In progress\" and \"Completed\". This is aggrevating aswell.

If it becomes figured out this can be used for more than just lame however...whith just about anything obviously.

lame atleast preserve\'s the orginal filename so i dont have to work out a scheme for that.

this is like i said...just to see what the \"batch scripting\" language can due when effort put forth...by it self and it\'s normal routines it plain sux...but it seems you might be able to trick it to do anything. I do know it can be done on *nix alot easier but even that requires external tools. Im just trying to use what the OS is supplied in. In *nix (Redhat 7.1) there is no tool that can due this also.