Skip to content

Commit

Permalink
Release Delete backups in project folder v2.0 (#1273)
Browse files Browse the repository at this point in the history
- Since v2.0 a "Backups" folder in the project folder now will also be cleared
  • Loading branch information
Tagirijus authored Oct 16, 2023
1 parent dae2fdb commit 9c1b9e2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions Various/tagirijus_Delete backups in project folder.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
-- @description Delete backups in project folder
-- @author Tagirijus
-- @version 1.0
-- @version 2.0
-- @changelog - Since v2.0 a "Backups" folder in the project folder now will also be cleared
-- @about
-- # Description
--
-- This little script will delete all the \*.rpp-bak files in the active project folder.
-- This little script will delete all the \*.rpp-bak files in the active project folder. In v2.0 it now also looks into the Backups-folder and removes the files in there as well.


function debugMsg(msg)
Expand Down Expand Up @@ -56,8 +57,34 @@ function DeleteBackupsInProjectFolder()
end


function DeleteBackupsInBackupFolder()

-- DELETE BACKUPS
retval, proj_path = reaper.EnumProjects( -1 )
if proj_path == "" then
return false
end
folder, proj_name, proj_ext = SplitFileName(proj_path)
folder = folder .. 'Backups\\'

local success = true
local files = EnumerateFiles( folder )
for i, file in ipairs( files ) do
if file:find( '%.rpp%-bak' ) then
success = os.remove(folder .. file)
if success == false then
debugMsg('Something went wrong during backup moving. "tagirijus_Delete backups in project folder.lua" in line 54.')
return false
end
end
end

end


function main()
DeleteBackupsInProjectFolder()
DeleteBackupsInBackupFolder()
end

main()

0 comments on commit 9c1b9e2

Please sign in to comment.