Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:58 02 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Maximite 2's MMEdit - How to put .BAK files in a separate folder

Author Message
dvanaria
Newbie

Joined: 04/03/2018
Location: United States
Posts: 15
Posted: 01:27am 12 Nov 2022
Copy link to clipboard 
Print this post

Is there a system command/setting that will redirect all backup files that MMEdit creates into another folder? Or optionally, prevent .BAK files from being created?

I'm finding that the .BAK files create a lot of clutter in my working directory.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7938
Posted: 07:45am 12 Nov 2022
Copy link to clipboard 
Print this post

Not as far as I know, but you can use the RENAME command to move your BAK files to a different directory if you wish.
I can't currently test this, but it might work. I can't remember how the CMM2 handles wildcards.
RENAME *.BAK AS backfiles/*.BAK

If you like to live without a file safety net you can probably get rid of them with:
KILL *.BAK
But I wouldn't recommend it.

I don't think there's a way of preventing them from being created - after all, it's a file safety device. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:03am 12 Nov 2022
Copy link to clipboard 
Print this post

What version of MMEdit?

Are you referring to *.bak files or files with a timestamp added to the *.bas file name?

Jim
VK7JH
MMedit
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 11:37am 12 Nov 2022
Copy link to clipboard 
Print this post

Are you thinking of the .bak files that the CMM2's editor creates? they tend to add uo.

Bill
Keep safe. Live long and prosper.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 11:36pm 13 Nov 2022
Copy link to clipboard 
Print this post

I think you are right, he is talking about the CMM2 editor, nothing to do with MMEdit

In that case,
'backup move
OPTION EXPLICIT
OPTION DEFAULT INTEGER
DIM f$

f$ = DIR$("*.bak", FILE)
 DO WHILE f$ <> ""
   COPY f$ TO "/backup/"+f$
   'kill f$
   PRINT f$
   f$ = DIR$()
 LOOP

You need to create a "backup" folder.

There isn't a MOVE command so we have to COPY and DELETE
I suggest you leave the KILL line remmed out until you are happy that the selected files are what you expect.

Jim
Edited 2022-11-14 09:36 by TassyJim
VK7JH
MMedit
 
dvanaria
Newbie

Joined: 04/03/2018
Location: United States
Posts: 15
Posted: 06:34pm 15 Nov 2022
Copy link to clipboard 
Print this post

Thank you, that works well. I'll leave the KILL line remarked out. The backups have already saved me more than one time, so they are definitely good to have.

Sorry for the confusion with the name of the editor, I thouht MMEdit was the name of the CMM2's editor. I didn't realize they are completely different programs. You're correct that I was just referring to the CMM2's editor. I'll try to correct the title of this forum post to reflect that.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 06:57pm 15 Nov 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Not as far as I know, but you can use the RENAME command to move your BAK files to a different directory if you wish.
I can't currently test this, but it might work. I can't remember how the CMM2 handles wildcards.
RENAME *.BAK AS backfiles/*.BAK


Hi Mick,

Doesn't work, and nor does KILL *.BAK. AFAIK only LS/FILES performs any sort of globbing on the CMM2.

  TassyJim said  ... There isn't a MOVE command ...


Hi Jim,

I don't have access to my CMM2 at the moment to confirm, but I believe you are mistaken and that RENAME will perform a MOVE.

Best wishes,

Tom
Edited 2022-11-16 05:02 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 07:22pm 15 Nov 2022
Copy link to clipboard 
Print this post

  thwill said  
I don't have access to my CMM2 at the moment to confirm, but I believe you are mistaken and that RENAME will perform a MOVE.

Best wishes,

Tom

I am sure you are right. It should work but all I get is:
Error in line 8: Access denied due to prohibited access

I haven't investigated further.

Jim
VK7JH
MMedit
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 08:30pm 15 Nov 2022
Copy link to clipboard 
Print this post

Found the problem with RENAME (in CMM2 V 5.0701)
It doesn't like the double dots in the destination name.

This works:
'backup move
OPTION EXPLICIT
OPTION DEFAULT INTEGER
DIM f$, d$

f$ = DIR$("*.bak", FILE)
 DO WHILE f$ <> ""
 d$ = "A:/backup/"+LEFT$(f$,LEN(f$)-7)+"bak"
 PRINT f$+" >>> "+d$
   RENAME f$ AS d$
   f$ = DIR$()
 LOOP

I don't think it needs the absolute path but not happy with ".BAS.BAK" even though it is OK when using COPY.

Jim
VK7JH
MMedit
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025