MS OS - Microsoft Forum to Usenet Gateway Header Right
Navbar Left Navbar Right


I'm trying to use a batch file to convert some .wav files to .mp3 files using a program called switch. All of my .wav files are stored in a directory



Reply
Old 11-21-2007, 02:58 PM   #1
ebferro
Guest
 
Posts: n/a
Default Batch File to manipulate path and file name

I'm trying to use a batch file to convert some .wav files to .mp3 files using
a program called switch. All of my .wav files are stored in a directory on
my network. The files are of the type h:\music\artist name\cd name\song.wav.
I want to convert all of these files to .mp3 files and store them in another
subdirectory. The files should be stored in h:\mp3\artist name\cd
name\song.mp3. I know I can use the for /R command to recursively go through
the h:\music subdirectory. My question is this. I need to pass the
h:\mp3\artist name\cd name portion of the path to switch to tell it where to
store the output files. How can I manipulate the path of the .wav file to
eliminate the music part of the path and replace it with mp3 and then remove
the song name from that path since switch assumes that the song name will be
the same with the .mp3 extension on it? The other question that I've got is
can I do this manipulation in a batch file before the for /R command so that
I've got a variable that is of the form h:\mp3\artist name\cd name and just
pass that variable to switch so that it can use that variable to tell it
where to store the output. Any help that can be offered will be greatly
appreciated.
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-21-2007, 03:13 PM   #2
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name


"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
> I'm trying to use a batch file to convert some .wav files to .mp3 files
> using
> a program called switch. All of my .wav files are stored in a directory
> on
> my network. The files are of the type h:\music\artist name\cd
> name\song.wav.
> I want to convert all of these files to .mp3 files and store them in
> another
> subdirectory. The files should be stored in h:\mp3\artist name\cd
> name\song.mp3. I know I can use the for /R command to recursively go
> through
> the h:\music subdirectory. My question is this. I need to pass the
> h:\mp3\artist name\cd name portion of the path to switch to tell it where
> to
> store the output files. How can I manipulate the path of the .wav file to
> eliminate the music part of the path and replace it with mp3 and then
> remove
> the song name from that path since switch assumes that the song name will
> be
> the same with the .mp3 extension on it? The other question that I've got
> is
> can I do this manipulation in a batch file before the for /R command so
> that
> I've got a variable that is of the form h:\mp3\artist name\cd name and
> just
> pass that variable to switch so that it can use that variable to tell it
> where to store the output. Any help that can be offered will be greatly
> appreciated.


I think I know what I want to do and I'm sure that it can be done.
However, after reading your note three times I'm still not sure that
I understand your exact aim. An example for each of the two
parts of your question would make things a lot clearer.


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 11-23-2007, 07:09 AM   #3
ebferro
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

Pegasus:
The short form is this:
Input File Name: h:\music\artist name\cd name\song name.wav
Output File Name Desired h:\mp3\artist name\cd name

How do I get from Input File Name to Output File Name Desired? I realize
that there is no song name.mp3 on the output file name desired. Switch, the
program that I'm using takes care of that on its own.

Second question summarizes to in a batch file, can I create a variable with
the input file name in it and massage that variable somehow to get the output
file name desired and then use that variable in a for /R loop to run through
all of the songs in my h:\music subdirectory to conver them? And, if I can,
how do I do that?
Thanks in advance.



"Pegasus (MVP)" wrote:

>
> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
> > I'm trying to use a batch file to convert some .wav files to .mp3 files
> > using
> > a program called switch. All of my .wav files are stored in a directory
> > on
> > my network. The files are of the type h:\music\artist name\cd
> > name\song.wav.
> > I want to convert all of these files to .mp3 files and store them in
> > another
> > subdirectory. The files should be stored in h:\mp3\artist name\cd
> > name\song.mp3. I know I can use the for /R command to recursively go
> > through
> > the h:\music subdirectory. My question is this. I need to pass the
> > h:\mp3\artist name\cd name portion of the path to switch to tell it where
> > to
> > store the output files. How can I manipulate the path of the .wav file to
> > eliminate the music part of the path and replace it with mp3 and then
> > remove
> > the song name from that path since switch assumes that the song name will
> > be
> > the same with the .mp3 extension on it? The other question that I've got
> > is
> > can I do this manipulation in a batch file before the for /R command so
> > that
> > I've got a variable that is of the form h:\mp3\artist name\cd name and
> > just
> > pass that variable to switch so that it can use that variable to tell it
> > where to store the output. Any help that can be offered will be greatly
> > appreciated.

>
> I think I know what I want to do and I'm sure that it can be done.
> However, after reading your note three times I'm still not sure that
> I understand your exact aim. An example for each of the two
> parts of your question would make things a lot clearer.
>
>
>

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-23-2007, 03:26 PM   #4
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

This batch file should get you started. You must remove the # chars
I used to mark the beginning of each line.

#@echo off
#set Source=d:\My Music
#for /F "delims=" %%a in ('dir /b /s "%Source%\*.wav"') do call :Sub %%a
#goto :eof
#
#:Sub
#for %%b in ("%*") do (
#echo Full name=%*
#echo Path=%%~pb
#echo File Name=%%~nb
#echo Ext=%%~xb
#)

Feel free to ask if you need an explanation of the code.


"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:6ECA3417-4706-438B-83EF-E25A0DCD2E94@microsoft.com...
> Pegasus:
> The short form is this:
> Input File Name: h:\music\artist name\cd name\song name.wav
> Output File Name Desired h:\mp3\artist name\cd name
>
> How do I get from Input File Name to Output File Name Desired? I realize
> that there is no song name.mp3 on the output file name desired. Switch,
> the
> program that I'm using takes care of that on its own.
>
> Second question summarizes to in a batch file, can I create a variable
> with
> the input file name in it and massage that variable somehow to get the
> output
> file name desired and then use that variable in a for /R loop to run
> through
> all of the songs in my h:\music subdirectory to conver them? And, if I
> can,
> how do I do that?
> Thanks in advance.
>
>
>
> "Pegasus (MVP)" wrote:
>
>>
>> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
>> > I'm trying to use a batch file to convert some .wav files to .mp3 files
>> > using
>> > a program called switch. All of my .wav files are stored in a
>> > directory
>> > on
>> > my network. The files are of the type h:\music\artist name\cd
>> > name\song.wav.
>> > I want to convert all of these files to .mp3 files and store them in
>> > another
>> > subdirectory. The files should be stored in h:\mp3\artist name\cd
>> > name\song.mp3. I know I can use the for /R command to recursively go
>> > through
>> > the h:\music subdirectory. My question is this. I need to pass the
>> > h:\mp3\artist name\cd name portion of the path to switch to tell it
>> > where
>> > to
>> > store the output files. How can I manipulate the path of the .wav file
>> > to
>> > eliminate the music part of the path and replace it with mp3 and then
>> > remove
>> > the song name from that path since switch assumes that the song name
>> > will
>> > be
>> > the same with the .mp3 extension on it? The other question that I've
>> > got
>> > is
>> > can I do this manipulation in a batch file before the for /R command so
>> > that
>> > I've got a variable that is of the form h:\mp3\artist name\cd name and
>> > just
>> > pass that variable to switch so that it can use that variable to tell
>> > it
>> > where to store the output. Any help that can be offered will be
>> > greatly
>> > appreciated.

>>
>> I think I know what I want to do and I'm sure that it can be done.
>> However, after reading your note three times I'm still not sure that
>> I understand your exact aim. An example for each of the two
>> parts of your question would make things a lot clearer.
>>
>>
>>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-23-2007, 04:49 PM   #5
ebferro
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

Pegasus:
Thanks for your help. I think I understand the code and we're getting
closer. I've run the batch file that you provided and it went through one cd
and started the second one. I got an error that says .wav was unexpected at
this time. The next song to be displayed has parentheses in its name. Could
that be the problem? There are a number of song names that have characters
like &, (, ), etc in them. Is there any way to accomodate these characters
if that's the problem?
Thanks again.

"Pegasus (MVP)" wrote:

> This batch file should get you started. You must remove the # chars
> I used to mark the beginning of each line.
>
> #@echo off
> #set Source=d:\My Music
> #for /F "delims=" %%a in ('dir /b /s "%Source%\*.wav"') do call :Sub %%a
> #goto :eof
> #
> #:Sub
> #for %%b in ("%*") do (
> #echo Full name=%*
> #echo Path=%%~pb
> #echo File Name=%%~nb
> #echo Ext=%%~xb
> #)
>
> Feel free to ask if you need an explanation of the code.
>
>
> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
> news:6ECA3417-4706-438B-83EF-E25A0DCD2E94@microsoft.com...
> > Pegasus:
> > The short form is this:
> > Input File Name: h:\music\artist name\cd name\song name.wav
> > Output File Name Desired h:\mp3\artist name\cd name
> >
> > How do I get from Input File Name to Output File Name Desired? I realize
> > that there is no song name.mp3 on the output file name desired. Switch,
> > the
> > program that I'm using takes care of that on its own.
> >
> > Second question summarizes to in a batch file, can I create a variable
> > with
> > the input file name in it and massage that variable somehow to get the
> > output
> > file name desired and then use that variable in a for /R loop to run
> > through
> > all of the songs in my h:\music subdirectory to conver them? And, if I
> > can,
> > how do I do that?
> > Thanks in advance.
> >
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
> >> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
> >> > I'm trying to use a batch file to convert some .wav files to .mp3 files
> >> > using
> >> > a program called switch. All of my .wav files are stored in a
> >> > directory
> >> > on
> >> > my network. The files are of the type h:\music\artist name\cd
> >> > name\song.wav.
> >> > I want to convert all of these files to .mp3 files and store them in
> >> > another
> >> > subdirectory. The files should be stored in h:\mp3\artist name\cd
> >> > name\song.mp3. I know I can use the for /R command to recursively go
> >> > through
> >> > the h:\music subdirectory. My question is this. I need to pass the
> >> > h:\mp3\artist name\cd name portion of the path to switch to tell it
> >> > where
> >> > to
> >> > store the output files. How can I manipulate the path of the .wav file
> >> > to
> >> > eliminate the music part of the path and replace it with mp3 and then
> >> > remove
> >> > the song name from that path since switch assumes that the song name
> >> > will
> >> > be
> >> > the same with the .mp3 extension on it? The other question that I've
> >> > got
> >> > is
> >> > can I do this manipulation in a batch file before the for /R command so
> >> > that
> >> > I've got a variable that is of the form h:\mp3\artist name\cd name and
> >> > just
> >> > pass that variable to switch so that it can use that variable to tell
> >> > it
> >> > where to store the output. Any help that can be offered will be
> >> > greatly
> >> > appreciated.
> >>
> >> I think I know what I want to do and I'm sure that it can be done.
> >> However, after reading your note three times I'm still not sure that
> >> I understand your exact aim. An example for each of the two
> >> parts of your question would make things a lot clearer.
> >>
> >>
> >>

>
>
>

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-23-2007, 05:07 PM   #6
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

Yes, parentheses belong to the so-called "poison" characters
in batch files. I'll have to think about this one.


"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:5DE24978-686F-4B1E-8E85-1FC3CC05569F@microsoft.com...
> Pegasus:
> Thanks for your help. I think I understand the code and we're getting
> closer. I've run the batch file that you provided and it went through one
> cd
> and started the second one. I got an error that says .wav was unexpected
> at
> this time. The next song to be displayed has parentheses in its name.
> Could
> that be the problem? There are a number of song names that have
> characters
> like &, (, ), etc in them. Is there any way to accomodate these
> characters
> if that's the problem?
> Thanks again.
>
> "Pegasus (MVP)" wrote:
>
>> This batch file should get you started. You must remove the # chars
>> I used to mark the beginning of each line.
>>
>> #@echo off
>> #set Source=d:\My Music
>> #for /F "delims=" %%a in ('dir /b /s "%Source%\*.wav"') do call :Sub %%a
>> #goto :eof
>> #
>> #:Sub
>> #for %%b in ("%*") do (
>> #echo Full name=%*
>> #echo Path=%%~pb
>> #echo File Name=%%~nb
>> #echo Ext=%%~xb
>> #)
>>
>> Feel free to ask if you need an explanation of the code.
>>
>>
>> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> news:6ECA3417-4706-438B-83EF-E25A0DCD2E94@microsoft.com...
>> > Pegasus:
>> > The short form is this:
>> > Input File Name: h:\music\artist name\cd name\song name.wav
>> > Output File Name Desired h:\mp3\artist name\cd name
>> >
>> > How do I get from Input File Name to Output File Name Desired? I
>> > realize
>> > that there is no song name.mp3 on the output file name desired.
>> > Switch,
>> > the
>> > program that I'm using takes care of that on its own.
>> >
>> > Second question summarizes to in a batch file, can I create a variable
>> > with
>> > the input file name in it and massage that variable somehow to get the
>> > output
>> > file name desired and then use that variable in a for /R loop to run
>> > through
>> > all of the songs in my h:\music subdirectory to conver them? And, if I
>> > can,
>> > how do I do that?
>> > Thanks in advance.
>> >
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >>
>> >> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> >> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
>> >> > I'm trying to use a batch file to convert some .wav files to .mp3
>> >> > files
>> >> > using
>> >> > a program called switch. All of my .wav files are stored in a
>> >> > directory
>> >> > on
>> >> > my network. The files are of the type h:\music\artist name\cd
>> >> > name\song.wav.
>> >> > I want to convert all of these files to .mp3 files and store them in
>> >> > another
>> >> > subdirectory. The files should be stored in h:\mp3\artist name\cd
>> >> > name\song.mp3. I know I can use the for /R command to recursively
>> >> > go
>> >> > through
>> >> > the h:\music subdirectory. My question is this. I need to pass the
>> >> > h:\mp3\artist name\cd name portion of the path to switch to tell it
>> >> > where
>> >> > to
>> >> > store the output files. How can I manipulate the path of the .wav
>> >> > file
>> >> > to
>> >> > eliminate the music part of the path and replace it with mp3 and
>> >> > then
>> >> > remove
>> >> > the song name from that path since switch assumes that the song name
>> >> > will
>> >> > be
>> >> > the same with the .mp3 extension on it? The other question that
>> >> > I've
>> >> > got
>> >> > is
>> >> > can I do this manipulation in a batch file before the for /R command
>> >> > so
>> >> > that
>> >> > I've got a variable that is of the form h:\mp3\artist name\cd name
>> >> > and
>> >> > just
>> >> > pass that variable to switch so that it can use that variable to
>> >> > tell
>> >> > it
>> >> > where to store the output. Any help that can be offered will be
>> >> > greatly
>> >> > appreciated.
>> >>
>> >> I think I know what I want to do and I'm sure that it can be done.
>> >> However, after reading your note three times I'm still not sure that
>> >> I understand your exact aim. An example for each of the two
>> >> parts of your question would make things a lot clearer.
>> >>
>> >>
>> >>

>>
>>
>>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-23-2007, 06:29 PM   #7
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

I recommend you try your luck in alt.msdos.batch.nt. They
love to dig their teeth into this sort of thing. Remember to
state the OS you use.


"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:5DE24978-686F-4B1E-8E85-1FC3CC05569F@microsoft.com...
> Pegasus:
> Thanks for your help. I think I understand the code and we're getting
> closer. I've run the batch file that you provided and it went through one
> cd
> and started the second one. I got an error that says .wav was unexpected
> at
> this time. The next song to be displayed has parentheses in its name.
> Could
> that be the problem? There are a number of song names that have
> characters
> like &, (, ), etc in them. Is there any way to accomodate these
> characters
> if that's the problem?
> Thanks again.
>
> "Pegasus (MVP)" wrote:
>
>> This batch file should get you started. You must remove the # chars
>> I used to mark the beginning of each line.
>>
>> #@echo off
>> #set Source=d:\My Music
>> #for /F "delims=" %%a in ('dir /b /s "%Source%\*.wav"') do call :Sub %%a
>> #goto :eof
>> #
>> #:Sub
>> #for %%b in ("%*") do (
>> #echo Full name=%*
>> #echo Path=%%~pb
>> #echo File Name=%%~nb
>> #echo Ext=%%~xb
>> #)
>>
>> Feel free to ask if you need an explanation of the code.
>>
>>
>> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> news:6ECA3417-4706-438B-83EF-E25A0DCD2E94@microsoft.com...
>> > Pegasus:
>> > The short form is this:
>> > Input File Name: h:\music\artist name\cd name\song name.wav
>> > Output File Name Desired h:\mp3\artist name\cd name
>> >
>> > How do I get from Input File Name to Output File Name Desired? I
>> > realize
>> > that there is no song name.mp3 on the output file name desired.
>> > Switch,
>> > the
>> > program that I'm using takes care of that on its own.
>> >
>> > Second question summarizes to in a batch file, can I create a variable
>> > with
>> > the input file name in it and massage that variable somehow to get the
>> > output
>> > file name desired and then use that variable in a for /R loop to run
>> > through
>> > all of the songs in my h:\music subdirectory to conver them? And, if I
>> > can,
>> > how do I do that?
>> > Thanks in advance.
>> >
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >>
>> >> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> >> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
>> >> > I'm trying to use a batch file to convert some .wav files to .mp3
>> >> > files
>> >> > using
>> >> > a program called switch. All of my .wav files are stored in a
>> >> > directory
>> >> > on
>> >> > my network. The files are of the type h:\music\artist name\cd
>> >> > name\song.wav.
>> >> > I want to convert all of these files to .mp3 files and store them in
>> >> > another
>> >> > subdirectory. The files should be stored in h:\mp3\artist name\cd
>> >> > name\song.mp3. I know I can use the for /R command to recursively
>> >> > go
>> >> > through
>> >> > the h:\music subdirectory. My question is this. I need to pass the
>> >> > h:\mp3\artist name\cd name portion of the path to switch to tell it
>> >> > where
>> >> > to
>> >> > store the output files. How can I manipulate the path of the .wav
>> >> > file
>> >> > to
>> >> > eliminate the music part of the path and replace it with mp3 and
>> >> > then
>> >> > remove
>> >> > the song name from that path since switch assumes that the song name
>> >> > will
>> >> > be
>> >> > the same with the .mp3 extension on it? The other question that
>> >> > I've
>> >> > got
>> >> > is
>> >> > can I do this manipulation in a batch file before the for /R command
>> >> > so
>> >> > that
>> >> > I've got a variable that is of the form h:\mp3\artist name\cd name
>> >> > and
>> >> > just
>> >> > pass that variable to switch so that it can use that variable to
>> >> > tell
>> >> > it
>> >> > where to store the output. Any help that can be offered will be
>> >> > greatly
>> >> > appreciated.
>> >>
>> >> I think I know what I want to do and I'm sure that it can be done.
>> >> However, after reading your note three times I'm still not sure that
>> >> I understand your exact aim. An example for each of the two
>> >> parts of your question would make things a lot clearer.
>> >>
>> >>
>> >>

>>
>>
>>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-24-2007, 08:22 AM   #8
Pegasus \(MVP\)
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

If you don't mind a mixed solution then you could use this batch
file as a starting point. It should process any "poison" characters
in the file names correctly.
#@echo off
#set delimiter=*
#set Source=My Music
#set TempFile=%temp%\files.txt
#
#dir /b /s "%Source%\*.wav" | cscript //nologo d:\temp\test.vbs %delimiter%
> "%TempFile%"

#for /F "tokens=1-4 usebackq delims=%delimiter%" %%a in ("%TempFile%") do (
# echo Full name=%%a
# echo Path=%%b
# echo Name=%%c
# echo Extension=%%d
#)

You must select a suitable delimiter, i.e. a character that will not
occur in any of your file names. I used an asterisk (*) since asterisks
are not allowed in file names.

And here is the VB Script test.vbs that goes with it:
#Set fso=CreateObject ("Scripting.FileSystemObject")
#Set stdin = fso.GetStandardStream (0)
#Set objArgs = WScript.Arguments
#
#delim = "*"
#If objArgs.Count > 0 Then delim = Left(objArgs(0), 1)
#
#Do
# line = stdin.ReadLine
# p = InStrRev(line, "\")
# q = InStrRev(line, ".")
# WScript.Echo line & delim & Left(line, p) & delim & Mid(line, p+1, q-p-1)
& delim & Right(line, 4)
#Loop Until stdin.AtEndOfStream

If you object to requiring two files to achieve your aim (one batch,
one VBS) then you could generate the .vbs file from within the
batch file with a number of suitable "echo" statements.


"ebferro" <ebferro@discussions.microsoft.com> wrote in message
news:5DE24978-686F-4B1E-8E85-1FC3CC05569F@microsoft.com...
> Pegasus:
> Thanks for your help. I think I understand the code and we're getting
> closer. I've run the batch file that you provided and it went through one
> cd
> and started the second one. I got an error that says .wav was unexpected
> at
> this time. The next song to be displayed has parentheses in its name.
> Could
> that be the problem? There are a number of song names that have
> characters
> like &, (, ), etc in them. Is there any way to accomodate these
> characters
> if that's the problem?
> Thanks again.
>
> "Pegasus (MVP)" wrote:
>
>> This batch file should get you started. You must remove the # chars
>> I used to mark the beginning of each line.
>>
>> #@echo off
>> #set Source=d:\My Music
>> #for /F "delims=" %%a in ('dir /b /s "%Source%\*.wav"') do call :Sub %%a
>> #goto :eof
>> #
>> #:Sub
>> #for %%b in ("%*") do (
>> #echo Full name=%*
>> #echo Path=%%~pb
>> #echo File Name=%%~nb
>> #echo Ext=%%~xb
>> #)
>>
>> Feel free to ask if you need an explanation of the code.
>>
>>
>> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> news:6ECA3417-4706-438B-83EF-E25A0DCD2E94@microsoft.com...
>> > Pegasus:
>> > The short form is this:
>> > Input File Name: h:\music\artist name\cd name\song name.wav
>> > Output File Name Desired h:\mp3\artist name\cd name
>> >
>> > How do I get from Input File Name to Output File Name Desired? I
>> > realize
>> > that there is no song name.mp3 on the output file name desired.
>> > Switch,
>> > the
>> > program that I'm using takes care of that on its own.
>> >
>> > Second question summarizes to in a batch file, can I create a variable
>> > with
>> > the input file name in it and massage that variable somehow to get the
>> > output
>> > file name desired and then use that variable in a for /R loop to run
>> > through
>> > all of the songs in my h:\music subdirectory to conver them? And, if I
>> > can,
>> > how do I do that?
>> > Thanks in advance.
>> >
>> >
>> >
>> > "Pegasus (MVP)" wrote:
>> >
>> >>
>> >> "ebferro" <ebferro@discussions.microsoft.com> wrote in message
>> >> news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
>> >> > I'm trying to use a batch file to convert some .wav files to .mp3
>> >> > files
>> >> > using
>> >> > a program called switch. All of my .wav files are stored in a
>> >> > directory
>> >> > on
>> >> > my network. The files are of the type h:\music\artist name\cd
>> >> > name\song.wav.
>> >> > I want to convert all of these files to .mp3 files and store them in
>> >> > another
>> >> > subdirectory. The files should be stored in h:\mp3\artist name\cd
>> >> > name\song.mp3. I know I can use the for /R command to recursively
>> >> > go
>> >> > through
>> >> > the h:\music subdirectory. My question is this. I need to pass the
>> >> > h:\mp3\artist name\cd name portion of the path to switch to tell it
>> >> > where
>> >> > to
>> >> > store the output files. How can I manipulate the path of the .wav
>> >> > file
>> >> > to
>> >> > eliminate the music part of the path and replace it with mp3 and
>> >> > then
>> >> > remove
>> >> > the song name from that path since switch assumes that the song name
>> >> > will
>> >> > be
>> >> > the same with the .mp3 extension on it? The other question that
>> >> > I've
>> >> > got
>> >> > is
>> >> > can I do this manipulation in a batch file before the for /R command
>> >> > so
>> >> > that
>> >> > I've got a variable that is of the form h:\mp3\artist name\cd name
>> >> > and
>> >> > just
>> >> > pass that variable to switch so that it can use that variable to
>> >> > tell
>> >> > it
>> >> > where to store the output. Any help that can be offered will be
>> >> > greatly
>> >> > appreciated.
>> >>
>> >> I think I know what I want to do and I'm sure that it can be done.
>> >> However, after reading your note three times I'm still not sure that
>> >> I understand your exact aim. An example for each of the two
>> >> parts of your question would make things a lot clearer.
>> >>
>> >>
>> >>

>>
>>
>>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 11-26-2007, 09:58 AM   #9
Bob I
Guest
 
Posts: n/a
Default Re: Batch File to manipulate path and file name

Just rename "Music" folder to "MP3", done deal.

ebferro wrote:

> Pegasus:
> The short form is this:
> Input File Name: h:\music\artist name\cd name\song name.wav
> Output File Name Desired h:\mp3\artist name\cd name
>
> How do I get from Input File Name to Output File Name Desired? I realize
> that there is no song name.mp3 on the output file name desired. Switch, the
> program that I'm using takes care of that on its own.
>
> Second question summarizes to in a batch file, can I create a variable with
> the input file name in it and massage that variable somehow to get the output
> file name desired and then use that variable in a for /R loop to run through
> all of the songs in my h:\music subdirectory to conver them? And, if I can,
> how do I do that?
> Thanks in advance.
>
>
>
> "Pegasus (MVP)" wrote:
>
>
>>"ebferro" <ebferro@discussions.microsoft.com> wrote in message
>>news:104B0630-6314-4D1A-8E1E-63AD63BE9ED8@microsoft.com...
>>
>>>I'm trying to use a batch file to convert some .wav files to .mp3 files
>>>using
>>>a program called switch. All of my .wav files are stored in a directory
>>>on
>>>my network. The files are of the type h:\music\artist name\cd
>>>name\song.wav.
>>>I want to convert all of these files to .mp3 files and store them in
>>>another
>>>subdirectory. The files should be stored in h:\mp3\artist name\cd
>>>name\song.mp3. I know I can use the for /R command to recursively go
>>>through
>>>the h:\music subdirectory. My question is this. I need to pass the
>>>h:\mp3\artist name\cd name portion of the path to switch to tell it where
>>>to
>>>store the output files. How can I manipulate the path of the .wav file to
>>>eliminate the music part of the path and replace it with mp3 and then
>>>remove
>>>the song name from that path since switch assumes that the song name will
>>>be
>>>the same with the .mp3 extension on it? The other question that I've got
>>>is
>>>can I do this manipulation in a batch file before the for /R command so
>>>that
>>>I've got a variable that is of the form h:\mp3\artist name\cd name and
>>>just
>>>pass that variable to switch so that it can use that variable to tell it
>>>where to store the output. Any help that can be offered will be greatly
>>>appreciated.

>>
>>I think I know what I want to do and I'm sure that it can be done.
>>However, after reading your note three times I'm still not sure that
>>I understand your exact aim. An example for each of the two
>>parts of your question would make things a lot clearer.
>>
>>
>>


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


All times are GMT -5. The time now is 02:02 PM.


Powered by vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Skin designed by CompletevB
Copyright © 2005-2008 Robert Schwarz, Sr. - All rights reserved - MS OS is an independent web site and is not affiliated with Microsoft Corporation.