Don't know these DIRBLOCK functions too well but if I understand correctly, they create a folder-structure within the application's main directory and leave it up to the user to delete?
If I'm understanding correctly, it could be that the files or a file is still "in use" (or marked so by windows). Sometimes you close a file in an application, yet it is still "in use" and cannot be deleted until the application is terminated (or sends a message to tell windows the files is closed??). So, if you can't delete the file, you can't delete the directory.
Solution 1: Make sure to "DELETE SOUND" all your loaded sounds (from that directory). Then use the "WAIT" command to wait about a second (some processes may be "busy"). Then call your close file procedure.
Solution 2: Along the route of solution 1, however, use a codition:
Psuedocode:
Function KillFile(file$)
While file$ Exist
Delete file$
Endwhile
EndFunction
This is a sorta brutish method and can be problematic as it'll keep looping until the file is deleted so you may wanna consider broadening it with a TIMER()-based error handling procedure; say, if it takes > 3 seconds, exit function with a return of 0, else return 1.
Solution 3: Write a batchfile to delete the files, then the directory and have it execute on program end, for example (It's been a while since I've scripted there may be mistakes in this as I can't test it right now):
@ECHO OFF
CD\
CD %1
rem The %1 is a variable for the first argument passed to the batch
rem In this case your pass the full path of the directory that you
rem want to erase, eg C:\Program Files\Mygame\media
DEL /F /Q *.*
CD..
RD media
EXIT
Note, you can run a batch-file invisibly using VBScript (Don't ask me how, I don't remember as vbs isn't my language of choice).
Other than that, can't think of anything else. Perhaps use a different method of protecting your assets like a basic encryption. I mean so far as I can tell, with the DIRBLOCK method somebody can still copy them from disk while your app is running so encrypting/un-encrypting would be about the same but it would give you the advantage of being able to access only what you needed when you needed it instead of having to unpack the whole directory... Or am I missing the point of dirblocks? Anyway, hope this is of some help.