Medmax


Hi,

I would need to delete any file and folder below a specific directory. I can delete files with the "ERASE *.txt" command but I don't know how to delete the subfolders which themselves contain files.

Also, I don't know in advance the name of the subfolders as they are created by an application. So the names can be anything!

I there any way to delete any structure (folders & files) below a specific directory

Thanks in advance.




Re: Delete any file/subfolder from a directory

CDFAUX


Hi Medmax.

Try this:

oFSO = CreateObject("Scripting.FileSystemObject")
ofso.DeleteFolder("c:\tmp\prueba", .t.) && The second parameter force deletion
ofso = null






Re: Delete any file/subfolder from a directory

dni

You may try:

d=GETDIR() &&select folder

d1=d+"*.*"

ERASE &d1 &&delete all files

RD &d &&remove folder