Hacking batch script to backup saves

dipasqma

Member
OP
Newcomer
Joined
Jun 21, 2006
Messages
6
Trophies
0
XP
112
Country
United States
I'm too lazy to manually backup my saves so I made a simple batch script to do it for me. Posting it here in case someone finds it useful. It might work on flash carts other than the G6L, I don't know. I've never used another cart.

The script:
Code:
@ECHO OFF

copy "%2:\%1\*.0" %3 >nul
copy "%2:\%1\*.1" %3 >nul
copy "%2:\%1\*.2" %3 >nul

if /i %1 equ nds del %3\wrg*
Hey, I did say it was simple. Download here but note that this a standard residential cable connection so who knows what kind of reliability I'll get. Anyway...
Parameter 1 is whether the save is "gba" or "nds".
Parameter 2 is the drive letter of the G6L. For me it would be "e".
Parameter 3 is the folder to save to so for me it is "C:\Documents and Settings\Mark\Desktop\Saves\NDS" with the quotes INCLUDED (if you couldn't tell the other parameters are meant w/o quotes).

Anyone who knows how to use this from the commandline can probably stop reading now but note that I recommend creating a shortcut to run the script as there is no error checking.

*** edit ***
Parameters are, in this case, information passed to the script when the script gets run. The parameters are separated by spaces. The last parameter, the location to store the saves, may have spaces in the folder names so by enclosing the location in quotes, spaces can be allowed. So to run the script from the commandline or from a shortcut, you need to:
* specify the location and name of the script (this is already set up for you if you create a shortcut)
* SPACE
* specify either GBA or NDS for the type of save (this is used in determining where the saves are on the G6L, case doesn't matter)
* SPACE
* specify the drive letter of the G6L (again, case doesn't matter)
* SPACE
* specify the location to put the saves
*** /edit ***

To create:
1. Download from: backup_g6l_saves.bat
-or-
1. Copy the script into notepad.
2. Save as whatever name you want with the extension ".bat". Set "Save as type" to "All Files". Example: backup_g6l_saves.bat

To set up:
1. Create the folder to store the saves.
2. Right-click the script and select "Create Shortcut".
3. Rename the shortcut if you wish.
4. Right-click the shortcut and select "Properties".
5. In the Target textbox, enter the parameters AFTER what is already in the textbox. Let me know if the example doesn't explain it well enough. In general, the textbox goes as: "" ""
Example:
Code:
"C:\Documents and Settings\Mark\Desktop\Saves\backup_g6l_saves.bat" nds e "C:\Documents and Settings\Mark\Desktop\Saves\NDS"
6. Click OK.
7. Repeat 1-6 for the GBA saves.

To run:
1. Double-click the shortcut. That's it.

* Existing saves get overwritten. If a save exists in the folder and the game and its saves are NOT on the G6L, then the saves will not be deleted. In my eyes, the functionality of this script is very intuitive. Regardless, I'm not responsible for lost saves so don't bother yelling at me as there is nothing I can do about it.
* These steps do work for me even if they somehow don't for you. I'll check back tomorrow or some time if anyone who cares needs help.
* I only spent about an hour total for doing the script and this thread so don't expect this to be of professional quality or absolutely perfect.

Enjoy
smile.gif


(edit #2: updated links)
 

antihaxer

Well-Known Member
Newcomer
Joined
Jul 3, 2006
Messages
94
Trophies
0
XP
156
Country
United States
Very nice. Will test when I get my g6 Lite. Always good to back up your saves incase you g6 gets corrupted. Some people might not know what parameters are or what you are talking about so you might want to add a more noob friendly guide.
 

zone97

Well-Known Member
Member
Joined
Feb 16, 2005
Messages
466
Trophies
0
Location
Eastern Time zone
Website
Visit site
XP
309
Country
United States
Even more simple... Download mirror folders. Then whenever you plug in your sd card, it will detect that folder and save the files yo a place you specified. all automatically you dont have to click anything.
 

dipasqma

Member
OP
Newcomer
Joined
Jun 21, 2006
Messages
6
Trophies
0
XP
112
Country
United States
Some people might not know what parameters are or what you are talking about so you might want to add a more noob friendly guide.
Good point.

For those who still don't know even after Qrayzie's post, they are, in this case, information passed to the script when the script gets run. The parameters are separated by spaces. The last parameter, the location to store the saves, may have spaces in the folder names so by enclosing the location in quotes, spaces can be allowed. So to run the script from the commandline or from a shortcut, you need to:
* specify the location and name of the script (this is already set up for you if you create a shortcut)
* SPACE
* specify either GBA or NDS for the type of save (this is used in determining where the saves are on the G6L, case doesn't matter)
* SPACE
* specify the drive letter of the G6L (again, case doesn't matter)
* SPACE
* specify the location to put the saves

I hope this along with my original post clarifies parameters for those who are confused.

Even more simple... Download mirror folders. Then whenever you plug in your sd card, it will detect that folder and save the files yo a place you specified. all automatically you dont have to click anything.
Like antihaxer said, the G6L doesn't have sd. Regardless, Windows isn't my primary OS (I run Windows only for the G6L under VPC on OS X) and was unaware such software existed for it. I should have assumed someone somewhere made free software that would do that but didn't think of it. Since I have a computer science background, I would personally find it easier to write this script then to download 3rd party software and configure it. Anyway, it is always good to point out alternatives that might be easier for some. To each his own.
 

SlyGuy

Well-Known Member
Member
Joined
Aug 4, 2006
Messages
396
Trophies
0
XP
209
Country
Canada
dipasqma, this is a great little utility! I have one request, if I may. Would it be possible for you to add to the script the ability to backup the GBA instant saves as well, please? I like to use them from time to time and it would be nice to backup all 6 saves in one click.

Thank-you very much for this script!
 

outphase

Custom title
Member
Joined
Nov 21, 2005
Messages
1,217
Trophies
0
Website
Visit site
XP
176
Country
United States
dipasqma, this is a great little utility! I have one request, if I may. Would it be possible for you to add to the script the ability to backup the GBA instant saves as well, please? I like to use them from time to time and it would be nice to backup all 6 saves in one click.

Thank-you very much for this script!

batch executables can be edited on your own.
 

SlyGuy

Well-Known Member
Member
Joined
Aug 4, 2006
Messages
396
Trophies
0
XP
209
Country
Canada
dipasqma, this is a great little utility!  I have one request, if I may.  Would it be possible for you to add to the script the ability to backup the GBA instant saves as well, please?  I like to use them from time to time and it would be nice to backup all 6 saves in one click.

Thank-you very much for this script!


batch executables can be edited on your own.

Yes, I know. However, I don't know how to write this type of script.
 

pubjoe

Well-Known Member
Member
Joined
Jul 17, 2006
Messages
113
Trophies
0
XP
267
Country
Just wondering about that last line: if /i %1 equ nds del %3\wrg*

shouldn't it read: if /i %1 equ %1 del %3\wrg* ?

...For example; in my .BAT, if I am backing up GBA, should I have:

if /i GBA equ nds del "D:\Emulator\Nintendo DS\save backup\GBA"\wrg*
(as per your instructions)

OR:
if /i GBA equ GBA del "D:\Emulator\Nintendo DS\save backup\GBA"\wrg*
(notice that I have changed "nds" to GBA)

?

Also, (I don't really understand the last line), will all my saves be overwritten each time I run it, or do they only get overwritten if they have changed. The first time I tried, they all backed up, but if I run the program again, nothing happens. Is it not deleting the duplicate files like it should, or is it supposed to do nothing (unless file information has changed)?

Hope my questions made sense.

Btw, I am running this .bat file...
Code:
@ECHO OFF

copy "\NDS\*.0" "D:\Emulator\Nintendo DS\save backup\NDS" >nul
copy "\NDS\*.1" "D:\Emulator\Nintendo DS\save backup\NDS" >nul
copy "\NDS\*.2" "D:\Emulator\Nintendo DS\save backup\NDS" >nul

if /i NDS equ nds del "D:\Emulator\Nintendo DS\save backup\NDS"\wrg*

copy "\GBA\*.0" "D:\Emulator\Nintendo DS\save backup\GBA" >nul
copy "\GBA\*.1" "D:\Emulator\Nintendo DS\save backup\GBA" >nul
copy "\GBA\*.2" "D:\Emulator\Nintendo DS\save backup\GBA" >nul

if /i GBA equ nds del "D:\Emulator\Nintendo DS\save backup\GBA"\wrg*
...Straight from my G6 ROOT folder. I don't specify a drive letter as my G6's drive letter often changes (due to other hardware).

it seems to work to backup saves once, but I don't know if it will overwrite properly, and if I have that last line written correctly?

Thanks.
 

SlyGuy

Well-Known Member
Member
Joined
Aug 4, 2006
Messages
396
Trophies
0
XP
209
Country
Canada
Yes, I know.  However, I don't know how to write this type of script.


copy "%2:\%1\*.0" %3 >nul
copy "%2:\%1\*.1" %3 >nul
copy "%2:\%1\*.2" %3 >nul

if these copy *.0 *.1 and *.2, how do you think you can add *.is0 *.is1 and *.is2?

Okay, okay, I get it! This is the code I came up with. Please let me know if there are any glaring errors that will mess up my saves/system. BTW, do I need to keep that "@ ECHO OFF" in there?

Thanks!

@ECHO OFF

copy "L:\gba\*.0" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul
copy "L:\gba\*.1" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul
copy "L:\gba\*.2" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul

copy "L:\gba\*.is0" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul
copy "L:\gba\*.is1" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul
copy "L:\gba\*.is2" "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons" >nul

if /i gba equ nds del "C:\Documents and Settings\Owner\My Documents\DS Stuff\Saves and Icons\GBA Saves and Icons"\wrg*
 

dipasqma

Member
OP
Newcomer
Joined
Jun 21, 2006
Messages
6
Trophies
0
XP
112
Country
United States
Sorry for the lateness, haven't been on the site for over a week.

About
Code:
if /i %1 equ nds del %3\wrg*
On my card and only in the NDS folder, I have a file called "wrg_rtggd.0??" where the ? are unidentified characters. To be honest I have no idea what this file is for but it gets backed up when the first copy command runs (so along with all the *.0 saves). I see no need to back it up so the line simply deletes the file if you're backing up nds saves. This is merely a personal preferance so feel free remove the delete completely. The delete command doesn't have to run when backing up gba saves because no such file exists in the gba folder. I considered not adding that line when posting this thread but I figured I would get a reply or 2 asking why some strange file was being backed up. Damned if you do, damned if you don't. I should have just explained it in my first post.

pubjoe:
About overwriting: Saves will only be overwritten if a save of the same name exists on the G6L. I.e.
Say you have 2 games: Mario Kart and Castlevania. All saves are backed up.
You get rid of Castlevania but add Phoenix Wright.
When backing up the saves again, the Mario Kart saves are updated to the version on the G6L (so they are overwritten). Castlevania saves are left alone as no Castlevania saves are on the G6L anymore. Phoenix Wright saves are backed up for the first time.

Code:
if /i %1 equ %1 del %3\wrg*
simply doesn't make sense because %1 will always be equal to %1. That line is essentially the same as
Code:
del %3\wrg*
in that the delete will run every time the script is executed.

Code:
if /i GBA equ nds del "D:\Emulator\Nintendo DS\save backup\GBA"\wrg*
doesn't make much sense either. I'm guessing you don't know much about batch scripts so I'll try to explain what's going on. Note I'm not good at explaining this type of thing so it might not make much sense if you have no programming experience.

if compares 2 strings (text) or numbers and runs a command if the result of the comparison is true.
/i tells the if command to compare strings while ignoring case (i.e. with /i "NDS" and "nds" are considered equal while without the /i "NDS" does NOT equal "nds")
GBA is the first string to compare
equ tells if that it should test for the two strings to be equal (as opposed to, say, greater than or equal to which would be "gte")
nds is the second string to compare

In this case, "GBA" will never equal "nds" so the delete command (del) will never run. But like I said at the beginning of this post, the delete doesn't have to run for gba saves as the file it would delete will never exist.

About the .bat that you quoted, what you are looking for is:
Code:
@ECHO OFF

copy "NDS\*.0" "D:\Emulator\Nintendo DS\save backup\NDS" >nul
copy "NDS\*.1" "D:\Emulator\Nintendo DS\save backup\NDS" >nul
copy "NDS\*.2" "D:\Emulator\Nintendo DS\save backup\NDS" >nul

del "D:\Emulator\Nintendo DS\save backup\NDS\wrg*"

copy "GBA\*.0" "D:\Emulator\Nintendo DS\save backup\GBA" >nul
copy "GBA\*.1" "D:\Emulator\Nintendo DS\save backup\GBA" >nul
copy "GBA\*.2" "D:\Emulator\Nintendo DS\save backup\GBA" >nul
Changes are:
1. The leading backslash for the source files to copy is not needed (perhaps the leading backslash would work but I don't know if Windows actually recognizes a starting backslash as root, the change I made I definitely know works though).
2. I removed the if statement completely. It was only there in my script because if backing up gba saves then the delete doesn't have to run. In your case since nds saves are always backed up, you might as well remove the if since all it does is waste a cpu cycle or 2.
3. I completely removed the last line for reasons I mentioned above which again is that no file beginning with "wrt" is backed up for gba saves so no delete is needed.

If that script is run from the root of the G6L then all nds and gba saves should be backed up to your folder.

I hope that answers everything. Lemme know otherwise.

GamerGuyDude:

The script you gave looks fine and shouldn't mess up your saves or system. The only change I would make would be to remove the last line with the if statement because the line isn't needed when backing up gba saves.

And, yes, you should keep @ECHO OFF in the script (although it doesn't REALLY matter). If you remove it, the script will output every command before they are executed. This is usually only helpful if you're trying to fix a script that doesn't work properly and since your script should work, removing the line will only slow down your script slightly.
 

SlyGuy

Well-Known Member
Member
Joined
Aug 4, 2006
Messages
396
Trophies
0
XP
209
Country
Canada
Thanks! Something happened to my Trauma Centre save though
frown.gif
I'm not sure what, but all the saves are blank now! I'm not sure what caused this. Either it's an error in the script or maybe I wrote over the saves with a freshly burned copy of Trauma...

Either way it sucks... though I did finish the game last night. Guess I'll never do the X missions...
 

Vidnez

Well-Known Member
Newcomer
Joined
Jul 31, 2006
Messages
54
Trophies
0
XP
157
Country
Thanks! Something happened to my Trauma Centre save though
frown.gif
 I'm not sure what, but all the saves are blank now! I'm not sure what caused this. Either it's an error in the script or maybe I wrote over the saves with a freshly burned copy of Trauma...

Either way it sucks... though I did finish the game last night. Guess I'll never do the X missions...


When you copy a game onto the G6 lite the U-Disk creates a new saves for the game, so maybe after you copied the game you run the script and overwrited your saves with the blank saves.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Psionic Roshambo @ Psionic Roshambo:
    So my opinion is that they could age a bit better in the future, and maybe AMD will continue improving them via drivers like they tend to do. No guarantee there but they have done it in the past. Just a feeling I have.
  • The Real Jdbye @ The Real Jdbye:
    cyberpunk at 4k without DLSS/fidelityfx *might* exceed 12gb
    +1
  • The Real Jdbye @ The Real Jdbye:
    but that game barely runs at native 4k
  • Psionic Roshambo @ Psionic Roshambo:
    I think it was some newer games and probably poorly optimized PS4 or PS5 ports
  • The Real Jdbye @ The Real Jdbye:
    they definitely will age better but i feel dlss might outweigh that since it looks about as good as native resolution and much less demanding
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    When I played Cyberpunk on my old 2080 Ti it sucked lol
  • The Real Jdbye @ The Real Jdbye:
    AMD could introduce something comparable to DLSS but nvidia's got a lot more experience with that
  • The Real Jdbye @ The Real Jdbye:
    least amd 7xxx has tensor cores which the previous generations didn't so there is the potential for AI upscaling
  • Psionic Roshambo @ Psionic Roshambo:
    They have FSR or whatever it's called and yeah it's still not great
  • The Real Jdbye @ The Real Jdbye:
    so AMD seem to finally be starting to take AI seriously
  • Psionic Roshambo @ Psionic Roshambo:
    Oh yeah those new 8000 CPUs have AI cores built in that's interesting
  • Psionic Roshambo @ Psionic Roshambo:
    Maybe they plan on offloading to the CPU?
  • Psionic Roshambo @ Psionic Roshambo:
    Would be kinda cool to have the CPU and GPU working in random more
  • Psionic Roshambo @ Psionic Roshambo:
    Tandem even
  • The Real Jdbye @ The Real Jdbye:
    i think i heard of that, it's a good idea, shouldn't need a dedicated GPU just to run a LLM or video upscaling
  • The Real Jdbye @ The Real Jdbye:
    even the nvidia shield tv has AI video upscaling
  • The Real Jdbye @ The Real Jdbye:
    LLMs can be run on cpu anyway but it's quite slow
  • BakerMan @ BakerMan:
    Have you ever been beaten by a wet spaghetti noodle by your girlfriend because she has a twin sister, and you got confused and fucked her dad?
  • Psionic Roshambo @ Psionic Roshambo:
    I had a girlfriend who had a twin sister and they would mess with me constantly.... Until one chipped a tooth then finally I could tell them apart.... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    They would have the same hair style the same clothes everything... Really messed with my head lol
  • Psionic Roshambo @ Psionic Roshambo:
    @The Real Jdbye, I could see AMD trying to pull off the CPU GPU tandem thing, would be a way to maybe close the gap a bit with Nvidia. Plus it would kinda put Nvidia at a future disadvantage since Nvidia can't make X86/64 CPUs? Intel and AMD licensing issues... I wonder how much that has held back innovation.
  • The Real Jdbye @ The Real Jdbye:
    i don't think nvidia wants to get in the x64 cpu market anyways
  • The Real Jdbye @ The Real Jdbye:
    you've seen how much intel is struggling getting into the gpu market
  • The Real Jdbye @ The Real Jdbye:
    and nvidia is already doing ARM
    The Real Jdbye @ The Real Jdbye: and nvidia is already doing ARM