Created
April 17, 2024 04:58
-
-
Save carrus2049/a543a0ff2201164052dd0d0764f8fe3f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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