How To | Use the dir.remove() Lua function to perform audio file cleanup

Learn how to effectively use the dir.remove() Lua function to quickly and conveniently clean up audio files in your system.

Updated at June 8th, 2023


On Q-SYS systems where recording and messaging features generate high quantities of audio files, it may be necessary to run a script that deletes files on a regular basis to avoid filling the Q-SYS media drive. While the dir.remove() function can delete a specified directory, that directory must be empty for the function to work. You must use the os.remove() function beforehand to delete files within the directory.

To see an iterative scripting example of deleting files followed by the parent directory, see the dir.remove() documentation within the dir (Directory) topic in Q-SYS Help.