Go Back   Cockos Incorporated Forums > REAPER Forums > Dstruct's Casa De Nitpicks

Reply
 
Thread Tools Display Modes
Old 07-20-2021, 06:14 AM   #41
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Phazma View Post
Only Windows, right? I’m on Mac…
Yeah just Windows sorry. Maybe one of the gurus here can script up something for Mac as it's relatively trivial
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 06:21 AM   #42
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by Coachz View Post
Yeah just Windows sorry. Maybe one of the gurus here can script up something for Mac as it's relatively trivial
I am not really sure that an OS-level workaround should be needed for such an obvious missing feature anyway. I really hope Justin and schwa recognize this and let us specify in preferences how many backups to keep. It has been requested for long time and for good reason.
Phazma is offline   Reply With Quote
Old 07-20-2021, 06:55 AM   #43
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Phazma View Post

EDIT2: Oh now I got how it works! It is just an action to manually delete all older backups once there are more than specified. Got my hopes up that this did all the backup weeding automatically as a running script.
Yes, it does it manually, but you can make a custom action and bundle this script with the Save action. so each time you manually save it tides things up.

Also, note this:
Let's say your current project is test.rpp and you have these backups:
Quote:
test-2021-07-20_1235.rpp-bak
test-2021-07-20_1230.rpp-bak
test-2021-07-20_1225.rpp-bak
test-2021-07-19_2300.rpp-bak
test-2021-07-19_2255.rpp-bak
test-2021-07-19_2250.rpp-bak
test-2021-07-18_1610.rpp-bak
test-2021-07-18_1605.rpp-bak
If you tell it to keep only 2 backups it will do this:
Quote:
test-2021-07-20_1235.rpp-bak
test-2021-07-20_1230.rpp-bak
test-2021-07-20_1225.rpp-bak
test-2021-07-19_2300.rpp-bak
test-2021-07-19_2255.rpp-bak
test-2021-07-19_2250.rpp-bak

test-2021-07-18_1610.rpp-bak
test-2021-07-18_1605.rpp-bak
It will keep the two most recent backups together with the latest backup for each different date.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 07:30 AM   #44
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

v1.01 if run from an unsaved project then it will tide up the folder where untitled project backups are saved.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 07:31 AM   #45
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by amagalma View Post
Yes, it does it manually, but you can make a custom action and bundle this script with the Save action. so each time you manually save it tides things up.
Ah yes, you have written this already but it flew over my head. It might be a feasible solution until native implementation. I will try it and see how it feels during actual usage. Thanks.
Phazma is offline   Reply With Quote
Old 07-20-2021, 07:57 AM   #46
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by amagalma View Post
Yes, it does it manually, but you can make a custom action and bundle this script with the Save action. so each time you manually save it tides things up.

Also, note this:
Let's say your current project is test.rpp and you have these backups:

If you tell it to keep only 2 backups it will do this:

It will keep the two most recent backups together with the latest backup for each different date.
Why don't I see your script in your Reapack ?

Keep x number of most recent timestamped backups of current project file (deletes older ones - no undo!)
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 08:35 AM   #47
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Coachz View Post
Why don't I see your script in your Reapack ?

Keep x number of most recent timestamped backups of current project file (deletes older ones - no undo!)

I had forgotten to add my user name in the start of the file name, so I added it:
"amagalma_Keep x number of most recent timestamped backups of current project file (deletes older ones - no undo!).lua"


If you sync now you will see it
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 09:03 AM   #48
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by amagalma View Post
I had forgotten to add my user name in the start of the file name, so I added it:
"amagalma_Keep x number of most recent timestamped backups of current project file (deletes older ones - no undo!).lua"


If you sync now you will see it
Thanks. After resyncing the repo shows "Keep x number of most recent timestamped backups of current project file" and the action shows "amagalma_Keep x number of most recent timestamped backups of current project file " and I got it.

It is set to 5 but it doesn't seem to remove all but 5. hmmm

__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 09:08 AM   #49
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by Coachz View Post
Thanks. After resyncing the repo shows "Keep x number of most recent timestamped backups of current project file" and the action shows "amagalma_Keep x number of most recent timestamped backups of current project file " and I got it.

It is set to 5 but it doesn't seem to remove all but 5. hmmm

The one with the username in front is the updated one.
Phazma is offline   Reply With Quote
Old 07-20-2021, 09:25 AM   #50
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Phazma View Post
The one with the username in front is the updated one.
that's what i'm running

__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 12:00 PM   #51
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

I see that for some reason the timestamp format that you have is different from the one on my system. To me there is an underscore ( _ ) between the date and the time, whereas to you there is a space character..
Quote:
ztemp-2021-01-11 1356.rpp-bak (yours)
ztemp-2021-01-11_1356.rpp-bak (mine)
I'll change it so that it matches either way..
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 07-20-2021 at 12:11 PM.
amagalma is offline   Reply With Quote
Old 07-20-2021, 12:05 PM   #52
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Try again with v1.02
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 03:15 PM   #53
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by amagalma View Post
Try again with v1.02
Thanks so much for your time. I have 1.02 now but still no joy. Welcoming 1.03.
:-)
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 03:47 PM   #54
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Do you run the script while your ztemp project is open and its tab is active? (In case you have other open projects in other tabs)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 05:57 PM   #55
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by amagalma View Post
Do you run the script while your ztemp project is open and its tab is active? (In case you have other open projects in other tabs)
Yeah, just ztemp open only.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-20-2021, 10:57 PM   #56
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Could you post a screen capture (Alt+PrtSc) of the project folder that is in detailed view and with the modified and created tabs enabled? Thanks!

Example:
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-20-2021, 11:43 PM   #57
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

v1.03 changelog
- Bug fix: invalid path of backup files residing directly in project folder (rather than inside a subdirectory)
- Revert to getting backup file date from creation date rather than from last modified date*


*: I use the JS_ReaScriptAPI to get the file's creation date, but I could get it directly from the filename.. Does anyone think that getting it directly from the name should be preferred and why? (apart from not requiring the JS_ReaScriptAPI)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 07-21-2021 at 01:58 AM.
amagalma is offline   Reply With Quote
Old 07-21-2021, 05:54 AM   #58
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

v1.03 no files were deleted. hmmm Also, I would go off of file modified date because if a project is corrupt and a user goes back to work on a backup and saves changes they would want that backup.

__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-21-2021, 07:05 AM   #59
mozart999uk
Human being with feelings
 
Join Date: Nov 2010
Posts: 1,742
Default

Quote:
Originally Posted by Phazma View Post
It has to be native at some point but for now this looks very promising, thanks!

I have just started testing it and it does not show up as running action.. is that normal? Does it work nonetheless if I put it into my startup action?

Also, I suppose this only works once the project is saved and a project directory created.. I (and probably others) often do a lot of experimentation before we decide to save a project and thus we need backups for unsaved projects. Can it be made to also work with unsaved projects? For example by referencing a temporary backup directory and once the project is saved move the backups to the project directory and continue doing them there?

It would be extra greatness if it created a folder called "Backups" inside the project directory to save the backups to and keep the Project directory tidy.


EDIT:
Sadly does not work :/ I have now more backups in the project directory than specified in the script..

EDIT2: Oh now I got how it works! It is just an action to manually delete all older backups once there are more than specified. Got my hopes up that this did all the backup weeding automatically as a running script.
I agree that this should be native. There's sooooo many FR's for it! However, in the meantime this looks really really good!
mozart999uk is offline   Reply With Quote
Old 07-22-2021, 07:47 AM   #60
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Coachz View Post
v1.03 no files were deleted. hmmm Also, I would go off of file modified date because if a project is corrupt and a user goes back to work on a backup and saves changes they would want that backup.


This is strange.. Your previous pic showed a space instead of an underscore between date and time... Anyway.. Go inside the script to line 114- and change this:
Code:
    if delete then
      --reaper.ShowConsoleMsg(files[i][1].."\n")
      os.remove( files[i][1] )
    end

To this:
Code:
    if delete then
      local ok = os.remove( files[i][1] )
      reaper.ShowConsoleMsg(files[i][1] .. " deleted: " .. (ok and "OK\n" or "FAILED!\n") )
    end

Try again and tell me if you got any messages..
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 10:58 AM   #61
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

First my apologies. I run a program that changes my windows explorer font size for my old eyes and it hides the underscore until you edit the filename so it was always there just not visible. Sorry. I ran it again to make it display properly.

On to the new script change. I updated the script and I get one message.

D:\studio projects\projects\ztemp\ztemp-2021-07-18_1153.rpp-bak deleted: OK

All files are of that format with the underscore after the date. Thanks for taking the time to help.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 11:53 AM   #62
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

No problem.. so it works
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 12:12 PM   #63
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

It only deletes one backup and leaves many more than the 5 that is set to keep.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 12:16 PM   #64
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

You missed this post

But ok, it seems that maybe not everyone likes this feature (certainly not you :P), so I 'll make it optional.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 12:33 PM   #65
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Are you saying the script currently keeps x number for each date ? If so I would need the other way which is just keep x number of most recent.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 12:47 PM   #66
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Quote:
Originally Posted by Coachz View Post
Are you saying the script currently keeps x number for each date ? If so I would need the other way which is just keep x number of most recent.
Nope! It will keep the number of backups you specified but it will do it for the last date. For all other dates, it will erase all backups but the latest one of each date..

Let's say your current project is test.rpp and you have these backups:
Quote:
test-2021-07-20_1235.rpp-bak
test-2021-07-20_1230.rpp-bak
test-2021-07-20_1225.rpp-bak
test-2021-07-19_2300.rpp-bak
test-2021-07-19_2255.rpp-bak
test-2021-07-19_2250.rpp-bak
test-2021-07-18_1610.rpp-bak
test-2021-07-18_1605.rpp-bak
If you tell it to keep only 2 backups it will do this:
Quote:
test-2021-07-20_1235.rpp-bak (1st to keep)
test-2021-07-20_1230.rpp-bak (2nd to keep)
test-2021-07-20_1225.rpp-bak (deleted)
test-2021-07-19_2300.rpp-bak (keeps it: most recent on a different date)
test-2021-07-19_2255.rpp-bak (deleted: same date)
test-2021-07-19_2250.rpp-bak (deleted: same date)
test-2021-07-18_1610.rpp-bak (keeps it: most recent on a different date)
test-2021-07-18_1605.rpp-bak (deleted: same date)
But anyway, I changed it, so this is optional (you can disable this feature inside the script if you don't like it)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 07-22-2021 at 12:53 PM.
amagalma is offline   Reply With Quote
Old 07-22-2021, 12:48 PM   #67
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

v1.05 changelog:
  • Get backup file date directly from filename rather than from creation date (JS_ReaScriptAPI not required any more)
  • Add option inside script to additionally keep the latest backup file per different date (default=true)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 01:11 PM   #68
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Yay. v1.05 with the option false is the hot ticket for me ! Thanks for making such a wonderful tool. I can see this going into my project startup script very soon.

local additionaly_keep_latest_file_per_different_date = false

__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 01:22 PM   #69
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Great idea! But it's not working here, tried changing " additionaly_keep_latest_file_per_different_date" and "files to keep" settings - nothing happens.
Skorobagatko is offline   Reply With Quote
Old 07-22-2021, 01:24 PM   #70
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by Skorobagatko View Post
Great idea! But it's not working here, tried changing " additionaly_keep_latest_file_per_different_date" and "files to keep" settings - nothing happens.
post your settings and a screenshot of your filenames in details view
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 02:06 PM   #71
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by Coachz View Post
post your settings and a screenshot of your filenames in details view


Skorobagatko is offline   Reply With Quote
Old 07-22-2021, 02:39 PM   #72
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

If you just want to keep the last 5 for example you would set this false

local additionaly_keep_latest_file_per_different_date = false

Try on a project you have backed up !!
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 03:02 PM   #73
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

The problem is the format of the timestamp, which contains seconds too. I'll fix it so that it takes that into account.
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 03:08 PM   #74
Coachz
Human being with feelings
 
Coachz's Avatar
 
Join Date: Oct 2010
Location: Charleston, SC
Posts: 12,791
Default

Quote:
Originally Posted by amagalma View Post
The problem is the format of the timestamp, which contains seconds too. I'll fix it so that it takes that into account.
Go with modified date on the system and be done with it.
__________________
Track Freezing Scripts

Coachz Repo
Coachz is offline   Reply With Quote
Old 07-22-2021, 03:28 PM   #75
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

v1.06 changelog:
- Take into account files with timestamps that contain seconds

(hopefully the final version)
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 03:38 PM   #76
Skorobagatko
Human being with feelings
 
Skorobagatko's Avatar
 
Join Date: Mar 2017
Location: Ukraine, Kyiv
Posts: 546
Default

Quote:
Originally Posted by amagalma View Post
v1.06 changelog:
- Take into account files with timestamps that contain seconds

(hopefully the final version)
Work perfectly now, thank you!
Skorobagatko is offline   Reply With Quote
Old 07-22-2021, 04:52 PM   #77
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

I should have released my version of this limit backup script,


It is solid since at least, never had any issue with it nor the beta testers. :P

EDIT: Actually my action works at project save so maybe it can still be useful.
X-Raym is offline   Reply With Quote
Old 07-22-2021, 10:36 PM   #78
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

Well done!


I bet in a few releases this feature will be native though
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma is offline   Reply With Quote
Old 07-22-2021, 11:04 PM   #79
Phazma
Human being with feelings
 
Join Date: Jun 2019
Posts: 2,875
Default

Quote:
Originally Posted by X-Raym View Post
EDIT: Actually my action works at project save so maybe it can still be useful.
Does your script work as a defer script (running in background)? I would actually prefer that over the workaround of a custom save action as proposed by amagalma.
Phazma is offline   Reply With Quote
Old 07-22-2021, 11:07 PM   #80
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,900
Default

@Phazma
It is not a defered script cause this would be less efficient (it would run 30 time per second and check files which is "slow"). It is just a script action to put on CTRL+S shortcut, which wrapes the usual save action.
X-Raym is offline   Reply With Quote
Reply

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 On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.