Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Delete backups in project folder v2.0 #1273

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading