Jump to content
LaunchBox Community Forums

CHDs for MAME - what to play and what to throw?


vaderag

Recommended Posts

On 9/12/2021 at 7:13 AM, DerSchlachter said:

Is there a buddy here who can write a .bat file in which you can insert the files to be copied, so that you only have to run this .bat with every MAME update.

My first try with a cmd File works not well, it runs into issues:

 

On Error Resume Next
Const QUELLE = "H:\Downloads Torrents\MAME 0.235 CHDs (merged)"
Const ZIEL = "I:\mame chd"
Const LISTE = "H:\Downloads\mame chd copy.xlsx"
Set objExcel = CreateObject("Excel.Application")
Set fso = CreateObject("Scripting.FileSystemObject")
objExcel.DisplayAlerts = False
With objExcel.Workbooks.Open(LISTE).Sheets(1)
	For Each cell In .Range("A1:A" & .Cells.Item(.Rows.Count,"A").End(-4162).Row)
		folder = QUELLE & "\" & cell.Value
		If fso.FolderExists(folder) Then fso.CopyFolder folder,ZIEL & "\", True
                If Err.Number <> 0 Then
			MsgBox "Fehler beim kopieren des Ordners '" & folder & "'" & vbNewLine & Err.Description, vbExclamation
			Err.Clear
		End If
	Next
End With
objExcel.DisplayAlerts = True
objExcel.Quit
MsgBox "Finished"

 

I like this idea, but think you may be overcomplicating - we just need to find out if a folder matches the file and if so, move it... 

I don't understand Powershell well, but this https://stackoverflow.com/a/32751715 seems like it could work with a little tweaking

Link to comment
Share on other sites

@DerSchlachter @vaderag If you're working with MAME chd's, and each one is properly stored in a folder...

image.png.89be78dce140f522f4e86a4b5b1f8535.png

And your destination folder (below) only has a select few of those that are in the source folder (above)

image.png.227c56bbb06323c7991ff41df90f88c0.png

Robocopy (built 'into' Windows) is relatively painless.

Rem  source folder = "H:\Downloads Torrents\MAME 0.235 CHDs (merged)"
Rem  destination folder = "I:\mame chd"
Rem  /XL   Copies folders/files from the source only if a folder/file of the same name already exists in the destination
Rem  /XX   Ignores files/folders in destination that aren't in the source
Rem  /MIR  Mirrors through subfolders

robocopy "H:\Downloads Torrents\MAME 0.235 CHDs (merged)" "I:\mame chd" /XL /XX /MIR

Copy/paste this into a text file, then save it as a batch file.  i.e.  "CopyUpdatedCHDs.bat".  (change your Source and Destination folders accordingly) Then run it.

(the 5 "Rem" lines are 'remarks' [comments] and safely do not get executed when in a batch file.  I've had someone ask me that before and thought I'd clear the air up front. ;) )

/XX is needed because /MIR would otherwise delete the 'destination' (i.e. "joewashere") if it's not in the 'source'.

This will only Copy things. Nothing get deleted or moved.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 9/12/2021 at 2:13 AM, DerSchlachter said:

Is there a buddy here who can write a .bat file in which you can insert the files to be copied, so that you only have to run this .bat with every MAME update.

If you can write a text file with the roms you want, (You can echo a directory listing into a text file as well), you can use that file to filter rom sets in ClrMamePro and do exactly what you want very easily.

Each MAME update you can use that same text file and it will pick up any rom changes within sets and fix as needed.  

Link to comment
Share on other sites

49 minutes ago, JoeViking245 said:

@DerSchlachter @vaderag If you're working with MAME chd's, and each one is properly stored in a folder...

image.png.89be78dce140f522f4e86a4b5b1f8535.png

And your destination folder (below) only has a select few of those that are in the source folder (above)

image.png.227c56bbb06323c7991ff41df90f88c0.png

Robocopy (built 'into' Windows) is relatively painless.

Rem  source folder = "H:\Downloads Torrents\MAME 0.235 CHDs (merged)"
Rem  destination folder = "I:\mame chd"
Rem  /XL   Copies folders/files from the source only if a folder/file of the same name already exists in the destination
Rem  /XX   Ignores files/folders in destination that aren't in the source
Rem  /MIR  Mirrors through subfolders

robocopy "H:\Downloads Torrents\MAME 0.235 CHDs (merged)" "I:\mame chd" /XL /XX /MIR

Copy/paste this into a text file, then save it as a batch file.  i.e.  "CopyUpdatedCHDs.bat".  (change your Source and Destination folders accordingly) Then run it.

(the 5 "Rem" lines are 'remarks' [comments] and safely do not get executed when in a batch file.  I've had someone ask me that before and thought I'd clear the air up front. ;) )

/XX is needed because /MIR would otherwise delete the 'destination' (i.e. "joewashere") if it's not in the 'source'.

This will only Copy things. Nothing get deleted or moved.

 

This sounds like it'll do the job nicely. Will give it a go when I get some time!

  • Like 2
Link to comment
Share on other sites

17 hours ago, JoeViking245 said:

@DerSchlachter @vaderag If you're working with MAME chd's, and each one is properly stored in a folder...

image.png.89be78dce140f522f4e86a4b5b1f8535.png

And your destination folder (below) only has a select few of those that are in the source folder (above)

image.png.227c56bbb06323c7991ff41df90f88c0.png

Robocopy (built 'into' Windows) is relatively painless.

Rem  source folder = "H:\Downloads Torrents\MAME 0.235 CHDs (merged)"
Rem  destination folder = "I:\mame chd"
Rem  /XL   Copies folders/files from the source only if a folder/file of the same name already exists in the destination
Rem  /XX   Ignores files/folders in destination that aren't in the source
Rem  /MIR  Mirrors through subfolders

robocopy "H:\Downloads Torrents\MAME 0.235 CHDs (merged)" "I:\mame chd" /XL /XX /MIR

Copy/paste this into a text file, then save it as a batch file.  i.e.  "CopyUpdatedCHDs.bat".  (change your Source and Destination folders accordingly) Then run it.

(the 5 "Rem" lines are 'remarks' [comments] and safely do not get executed when in a batch file.  I've had someone ask me that before and thought I'd clear the air up front. ;) )

/XX is needed because /MIR would otherwise delete the 'destination' (i.e. "joewashere") if it's not in the 'source'.

This will only Copy things. Nothing get deleted or moved.

 

image.thumb.png.9566c2f55245a849fe8eefa7650f4dd7.png

 

Okay, so this didn't work for me and I think I know why... it's looking for folders matching folders - the files/folders description led me to a false sense that it would compare both :(

What I need is folder names which match zip

So, for example - area51.zip is in my Mame 234 Trimmed folder

I want to copy area51 folder across from the CHD folder...

Is there any way for it to ignore the type?

 

EDIT: Also, there is a way to make this destructive accidentally so be warned - I tried removing the .zip from area51.zip and then ran it, it didn't do anything except delete area51 file for some reason...

EDIT2: Even if I create an empty directory called area51 in the destination then I still don't get a copy, only a skip

image.thumb.png.f1b33a4cf9c5fec2cbd753af9ce2e905.png

Edited by vaderag
Link to comment
Share on other sites

1 hour ago, vaderag said:

only a skip

Since this was (so I thought) for 'updating' the chd's, the robocopy method I gave:

Sees  ../area51/area51.chd  in the Source folder and looks for  ../area51/area51.chd  [same folder and file names] in the Destination folder.

If it exists [finds a match] in the Destination folder, AND it has a different file size, it will replace it ('update' it) with the one from the Source folder.

Maybe I misread what you're trying to do.  Does your Trimmed folder not yet have the chd subfolders/files?  If it doesn't, then ya. We need a completely different method. ;) My apologies. 

Link to comment
Share on other sites

52 minutes ago, JoeViking245 said:

Since this was (so I thought) for 'updating' the chd's, the robocopy method I gave:

Sees  ../area51/area51.chd  in the Source folder and looks for  ../area51/area51.chd  [same folder and file names] in the Destination folder.

If it exists [finds a match] in the Destination folder, AND it has a different file size, it will replace it ('update' it) with the one from the Source folder.

Maybe I misread what you're trying to do.  Does your Trimmed folder not yet have the chd subfolders/files?  If it doesn't, then ya. We need a completely different method. ;) My apologies. 

Correct. The problem stems from the fact that while Launchbox does the trimming, and the exporting to a separate folder (which I've called trimmed), it doesn't pull the chds

So while all the ROMs are in the trimmed folder the matching CHD folders are not.

I'm trying to find a way other than a manual compare to pull the needed chd's into the ROMs folder.

 

Link to comment
Share on other sites

21 hours ago, vaderag said:

it doesn't pull the chds

Ya, LB won't do that for you. But that's OK since there isn't really a ton of MAME chd's that A) do work, and B) are worth playing.  But that's just me. :) 

Let's try this:

Folder "a"  -  This is your "Trimmed" folder that holds your personalized special collection of .zip files.

Folder "b"  -  This is where you've downloaded every MAME chd possible.  This contains subfolders with the exact same name as it's corresponding zip file. Inside each subfolder contains the chd file for that game

Folder "c"  -  This is where you want to copy ONLY the subfolders (and their contents) in "c" that have a matching zip file (i.e. same name) in "a".

@echo off
set sourceZIPs=d:\temp1\a
set sourceCDHs=d:\temp1\b
set destCHDs=d:\temp1\c

for %%F in ("%sourceZIPs%\*.zip") do (
    if exist "%sourceCDHs%\%%~nF" ( 
      xcopy "%sourceCDHs%\%%~nF" "%destCHDs%\%%~nF" /e /i 
    )
)
pause

Just "set" the 3 respective folders to match yours. If you're copying the chd folders to the same location as the .zip files, just set the path_to 'a' and 'c' to the same location.  chd's are large files so it will take a while.  I added "pause" at the end so you'll know it's done when it says "Press any key to continue...".

You could put a letter in front of "*.zip" just to do a few at a time.  For example to do just the ones that start with "B":

for %%F in ("%sourceZIPs%\b*.zip") do (

 

Batch file broken down:

For all the files in the Folder "a" that have a .zip extension
If Folder "b" contains a subfolder with the exact same name as the file (minus extension) in "a"
Copy THAT subfolder and it contents to Folder "c"

Edited by JoeViking245
fixed "xcopy" line in batch script
  • Game On 1
Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

Ya, LB won't do that for you. But that's OK since there isn't really a ton of MAME chd's that A) do work, and B) are worth playing.  But that's just me. :) 

Let's try this:

Folder "a"  -  This is your "Trimmed" folder that holds your personalized special collection of .zip files.

Folder "b"  -  This is where you've downloaded every MAME chd possible.  This contains subfolders with the exact same name as it's corresponding zip file. Inside each subfolder contains the chd file for that game

Folder "c"  -  This is where you want to copy ONLY the subfolders (and their contents) in "c" that have a matching zip file (i.e. same name) in "a".

@echo off
set sourceZIPs=d:\temp1\a
set sourceCDHs=d:\temp1\b
set destCHDs=d:\temp1\c

for %%F in ("%sourceZIPs%\*.zip") do (
    if exist "%sourceCDHs%\%%~nF" ( 
      xcopy "%sourceCDHs%\%%~nF" "%destCHDs%%%~nF" /e /i 
    )
)
pause

Just "set" the 3 respective folders to match yours. If you're copying the chd folders to the same location as the .zip files, just set the path_to 'a' and 'c' to the same location.  chd's are large files so it will take a while.  I added "pause" at the end so you'll know it's done when it says "Press any key to continue...".

You could put a letter in front of "*.zip" just to do a few at a time.  For example to do just the ones that start with "B":

for %%F in ("%sourceZIPs%\b*.zip") do (

 

Batch file broken down:

For all the files in the Folder "a" that have a .zip extension
If Folder "b" contains a subfolder with the exact same name as the file (minus extension) in "a"
Copy THAT subfolder and it contents to Folder "c"

That looks exactly the ticket!

Will give it a go tomorrow if I get a chance!! Thanks so much

 

  • Like 1
Link to comment
Share on other sites

14 hours ago, JoeViking245 said:

Ya, LB won't do that for you. But that's OK since there isn't really a ton of MAME chd's that A) do work, and B) are worth playing.  But that's just me. :) 

Let's try this:

Folder "a"  -  This is your "Trimmed" folder that holds your personalized special collection of .zip files.

Folder "b"  -  This is where you've downloaded every MAME chd possible.  This contains subfolders with the exact same name as it's corresponding zip file. Inside each subfolder contains the chd file for that game

Folder "c"  -  This is where you want to copy ONLY the subfolders (and their contents) in "c" that have a matching zip file (i.e. same name) in "a".

@echo off
set sourceZIPs=d:\temp1\a
set sourceCDHs=d:\temp1\b
set destCHDs=d:\temp1\c

for %%F in ("%sourceZIPs%\*.zip") do (
    if exist "%sourceCDHs%\%%~nF" ( 
      xcopy "%sourceCDHs%\%%~nF" "%destCHDs%%%~nF" /e /i 
    )
)
pause

Just "set" the 3 respective folders to match yours. If you're copying the chd folders to the same location as the .zip files, just set the path_to 'a' and 'c' to the same location.  chd's are large files so it will take a while.  I added "pause" at the end so you'll know it's done when it says "Press any key to continue...".

You could put a letter in front of "*.zip" just to do a few at a time.  For example to do just the ones that start with "B":

for %%F in ("%sourceZIPs%\b*.zip") do (

 

Batch file broken down:

For all the files in the Folder "a" that have a .zip extension
If Folder "b" contains a subfolder with the exact same name as the file (minus extension) in "a"
Copy THAT subfolder and it contents to Folder "c"

There is some kind of bug here - I thought it was the missing \ in the xcopy line after destCDHs variable, but wasn't the fix.

Without the \ I end up with a folder name of the "destCHDsfoldeRarea51" so there does need to be a slash, but with the slash the files end up in the root (temp1 in your example) rather than the destCHDs

I can definitely work with this, but would be nice to work out what is wrong so that can be useful for others and seamless updates! 

(I could probably work this out but my kids aren't giving me a minute today!!!)

 

EDIT: It was the missing \ but I put it back in the wrong place :)

 

@echo off
set sourceZIPs=I:\CLEAN ARCADE SETUP\Roms\MAME 234 Trimmed
set sourceCDHs=I:\ARCADE ROMS WIP\CHD
set destCHDs=I:\ARCADE ROMS WIP\CHD IN USE

for %%F in ("%sourceZIPs%\*.zip") do (
    if exist "%sourceCDHs%\%%~nF" ( 
      xcopy "%sourceCDHs%\%%~nF" "%destCHDs%\%%~nF" /e /i 
    )
)
pause

Edited by vaderag
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, vaderag said:

It was the missing \

You're right.  That's what I get for still testing it at the same time as writing the post. lol  Thank your kids for me for allowing you time to work this out!! ;) And thank you for taking the time to find the error!!!  I updated the original post so future readers can [hopefully] have less time away from their kids. :D

  • Unusual Gem 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...