Looping through Matching strings to complete actions...

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
phoenix_Rising
Posts: 38
Joined: 04 Apr 2012 03:11

Looping through Matching strings to complete actions...

#1 Post by phoenix_Rising » 30 Apr 2012 05:29

Hi guys,

I have a relatively easy one that's been bugging me for a while!

If i have the following files in the following pathname and folder: "C:\music\Jazz\Jazz Classics Vol1 Disc1\"

-------------------------------
Jazz classics vol1 Disc 1.ape
Jazz Classics vol1 Disc 2.ape
Cuesheet1.cue
Cuesheet2.cue
-------------------------------
I'd like to do the following with them:

1) use the filename of EACH ape file (minus the extension) as a findstr to see if it exists in
ANY of the cuefiles in the same folder.
2) If findstr command finds a match in the cuesheet I need it to create a folder based on the
.ape filename that it found the match in and move the .ape file and the corresponding .cue file to that folder.
3) I need it to loop through the whole low level folder and do this with every ape file in the folder c:\music

Anyone?

phoenix_Rising
Posts: 38
Joined: 04 Apr 2012 03:11

Re: Looping through Matching strings to complete actions...

#2 Post by phoenix_Rising » 03 May 2012 08:41

Still struggling with this anyone got any leads what would be a good way to tackle it?

Squashman
Expert
Posts: 4471
Joined: 23 Dec 2011 13:59

Re: Looping through Matching strings to complete actions...

#3 Post by Squashman » 03 May 2012 08:58

phoenix_Rising wrote:Hi guys,

I have a relatively easy one that's been bugging me for a while!

If i have the following files in the following pathname and folder: "C:\music\Jazz\Jazz Classics Vol1 Disc1\"

-------------------------------
Jazz classics vol1 Disc 1.ape
Jazz Classics vol1 Disc 2.ape
Cuesheet1.cue
Cuesheet2.cue
-------------------------------
I'd like to do the following with them:

1) use the filename of EACH ape file (minus the extension) as a findstr to see if it exists in
ANY of the cuefiles in the same folder.
2) If findstr command finds a match in the cuesheet I need it to create a folder based on the
.ape filename that it found the match in and move the .ape file and the corresponding .cue file to that folder.
3) I need it to loop through the whole low level folder and do this with every ape file in the folder c:\music

Anyone?

I guess I am confused because based on his description wouldn't he end up with the following structure:
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 1\Jazz classics vol1 Disc 1.ape
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 1\Cuesheet1.cue
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 2\Jazz classics vol1 Disc 2.ape
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 2\Cuesheet2.cue

Fawers
Posts: 187
Joined: 08 Apr 2012 17:11
Contact:

Re: Looping through Matching strings to complete actions...

#4 Post by Fawers » 03 May 2012 09:09

Squashman wrote:I guess I am confused because based on his description wouldn't he end up with the following structure:
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 1\Jazz classics vol1 Disc 1.ape
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 1\Cuesheet1.cue
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 2\Jazz classics vol1 Disc 2.ape
C:\music\Jazz\Jazz Classics Vol1 Disc1\Jazz classics vol1 Disc 2\Cuesheet2.cue


Yes, I thought that too.
Maybe he meant the .cue files have the same filename as the .ape ones? And this example was just to, well, illustrate the situation?
Phoenix_rising?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Looping through Matching strings to complete actions...

#5 Post by foxidrive » 03 May 2012 09:29

phoenix_Rising wrote:If i have the following files in the following pathname and folder: "C:\music\Jazz\Jazz Classics Vol1 Disc1\"

-------------------------------
Jazz classics vol1 Disc 1.ape
Jazz Classics vol1 Disc 2.ape
Cuesheet1.cue
Cuesheet2.cue
-------------------------------
I'd like to do the following with them:

1) use the filename of EACH ape file (minus the extension) as a findstr to see if it exists in
ANY of the cuefiles in the same folder.
2) If findstr command finds a match in the cuesheet I need it to create a folder based on the
.ape filename that it found the match in and move the .ape file and the corresponding .cue file to that folder.
3) I need it to loop through the whole low level folder and do this with every ape file in the folder c:\music


Can cuesheet1.cue or Cuesheet2.cue have both "Jazz Classics vol1 Disc 2.ape" and "Jazz Classics vol1 Disc 2.ape" inside them?

The cue/ape files will be moved with the first match and so can't be compared for the second and subsequent .ape files.

Post Reply