Skip to content

Instantly share code, notes, and snippets.

@carrus2049
Created April 17, 2024 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carrus2049/a543a0ff2201164052dd0d0764f8fe3f to your computer and use it in GitHub Desktop.
Save carrus2049/a543a0ff2201164052dd0d0764f8fe3f to your computer and use it in GitHub Desktop.
local function getPathDelimiter()
local os = reaper.GetOS()
if os == 'Win32' or os == 'Win64' then
return '\\'
else
return '/'
end
end
local PD = getPathDelimiter()
function get_dir_folders(dir_path)
local folders = {}
local i = 0
while true do
local folder_name = reaper.EnumerateSubdirectories(dir_path, i)
if not folder_name then break end
local folder_path = dir_path .. PD .. folder_name
table.insert(folders, folder_path)
i = i + 1
end
return folders
end
function get_dir_files(dir_path)
local files = {}
local i = 0
while true do
local file_name = reaper.EnumerateFiles(dir_path, i)
if not file_name then break end
local file_path = dir_path .. PD .. file_name
table.insert(files, file_path)
i = i + 1
end
return files
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment