Help - Search - Members - Calendar
Full Version: Command line for 'delete source'
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
jimhaddon
Iv been looking for ages, for a command in lame that lets you delete the source file when encoded. I am aware that there are front-ends like Razorlame that could do this for me, but id like to do it manually if at all possible.
Thanks for your help
James
jimhaddon
Anyone? Does anyone have any idea? I know in wavpack its -d but not in lame
madoka
QUOTE (jimhaddon @ Aug 13 2004, 12:04 PM)
Iv been looking for ages, for a command in lame that lets you delete the source file when encoded. I am aware that there are front-ends like Razorlame that could do this for me, but id like to do it manually if at all possible.
Thanks for your help
James
*

Just use the ampersand symbol "&" which will join multiple commands into one line. In particular:

CODE
lame --preset standard input.wav output.mp3 & del input.wav


...should do what you want.
jimhaddon
Neally, but i wanted it so i could place the batch file in a folder, and have it encode the entire folder, deleting as it went along.
jimhaddon
Like

CODE
lame --preset medium (insert code for deleting source) *.wav


this would make lame encode the first wav in the folder, then delete the source. If this code was looped, then Lame would eventually encode all the files in the folder right?
madoka
QUOTE (jimhaddon @ Aug 15 2004, 01:45 PM)
Like

CODE
lame --preset medium (insert code for deleting source) *.wav


this would make lame encode the first wav in the folder, then delete the source. If this code was looped, then Lame would eventually encode all the files in the folder right?
*

I don't think your example will work: lame only accepts one input at a time. Use the "for" loop construct.

CODE
for %f in (*.wav) do lame --preset standard %f & del %f
Infophreak
QUOTE
CODE
for %f in (*.wav) do lame --preset standard %f & del %f


That is wrong. What this will do is that it will first encode all files matching *.wav, and then it will try to delete the file named %f. What you want to do is this:

CODE
for %f in (*.wav) do lame --preset standard "%f" "&" del "%f"


The "'s around %f are important if you have any files with for example spaces or ampersands in them.

I learned this the hard way when I had to convert a bunch of APE files to FLAC with the commandline. Since they were spread out over a huge number of directories, I wanted to use sweep.exe and not the Monkey's Audio GUI, but because mac.exe doesn't allow you to decompress to console, you can't do the really easy thing and pipe the output of mac.exe to flac.exe, so I had to decompress to temporary .wav files, encode that and delete the .wav and the .ape.
jimhaddon
yer, that does work, thanx, but my command would work. I know lame only takes 1 file at a time, but if you LOOPED my command, it would work right?

edit: actually, i cant get your command to work. what have i done wrong
madoka
QUOTE (Infophreak @ Aug 15 2004, 06:21 PM)
QUOTE
CODE
for %f in (*.wav) do lame --preset standard %f & del %f


That is wrong. What this will do is that it will first encode all files matching *.wav, and then it will try to delete the file named %f. What you want to do is this:

CODE
for %f in (*.wav) do lame --preset standard "%f" "&" del "%f"

*

Yes, quoting "%f" is usually a good idea, but are you sure quoting the ampersand is necessary? As a test, I tried the following:

CODE
for %f in (*) do echo "%f" & echo "%f"

It gave the expected output of printing the name of every file twice, as opposed to printing the file name, then printing "%f".
/\/ephaestous
Also you should use && instead of & so it only deletes the file if the encoding was sucessful
jimhaddon
ok, this code still doesn't work for me. I get the error '%f' was not expected. Im using a dos batch file. Is this right?
jimhaddon
its ok, i got it, you need to add a % in. ie, instead of %f, you need to use %%f
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.