|
Post by xxgeek on Oct 10, 2022 21:36:35 GMT
Been working on a project where I needed to delete an entire folder. hmmm. Until I can buckle down on the info$()function this will have to do. Hopefully someone else will find this helpful too.
'by xxgeek Oct 2022
' This function deletes any folder along with all sub folders and files.
' cmd.exe is Windows Command Shell /c closes the command shell when mission completes ' rd command to remove the directory ' /s deletes all sub folders and files - Note: cannot delete files in use ' /q does it quietly - nothing to see, or interupt, even on errors - eg: "File in use" If there is a "file in use" then all folders on the path to that file will not get deleted either; Since a folder cannot be deleted with any files in it, or any folders containing files or folders.
anyfolder$ = "Path to any folder" ' eg: "c:\MyFiles\BasFiles\Old" deletes the "Old" folder completely
anyfolder$ = delDir$(anyfolder$)
end
function delDir$(folder$) run "cmd.exe /c rd /s /q ";folder$ end function
|
|