General information
Category:
Coding, syntax & commands
Title:
Recursive Remove Directory
semi-follow up to the MD issue
I need to remove a root directory, which may contain subdirectories. Recursion seemed the simplest solution:
1. Delete the files
2. Remove the subdirectories
3. Remove the root directory
FUNCTION RemoveDirectory
Parameters dirpath
Dele file (dirpath+"*.*")
entries = adir(aRemDirs,dirpath+"*.*","D")
If entries >= 0
for i = 1 to entries
If !Inlist(aRemDirs(i,1),".","..")
RemoveDirectory(dirpath+aRemDirs(i,1)+"\")
Endif
Next
Endif
RD (dirpath)
Return && RemoveDirectory
I read in the help that functions' parameters are passed by value, and i THOUGHT this would protect the scoping necessary for recursion. It's late on a friday, and while i can see this isn't working, i can't seem to figure out why.
I'm hoping someone will immediately see what i'm doing wrong. TIA
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only