Hello,
I'm trying to create a function that deletes folders in a smarter way. The normal Folder.Delete does not delete a folder when there are other files and folders in it. Currently i am solving the part of deleting folders. This is what my code looks like.
But it isn't working perfectly. Try it yourself. When you have multiple top level folders with some child folders it doesn't delete the last top level folder. It may be other kind of program code that causes it but i am not sure. I would appreciate it if you can help me fix this thing. And maybe in a way it deletes files in those folders too.
So that other AMS users can have this function too.
I am pretty sure i did see something similar on this forum...but can't find it.
I'm trying to create a function that deletes folders in a smarter way. The normal Folder.Delete does not delete a folder when there are other files and folders in it. Currently i am solving the part of deleting folders. This is what my code looks like.
Code:
function Folder.SmartDelete(f) if f then if Folder.DoesExist(f) == true then local folders = Folder.Find(f, "*", true, nil) if folders then local i = "" local v = "" for i, v in pairs(folders) do Folder.SmartDelete(v) end else Folder.Delete(f) end end end end
So that other AMS users can have this function too.
I am pretty sure i did see something similar on this forum...but can't find it.
Comment