Question about FAILNOTEMPTY

I just noticed today that I am having a problem with nonempty folders being deleted by my function. I am using Delete FAILNOTEMPTY NORECYCLE QUIET command to delete folder. I thought this would prevent nonempty folders from being accidentally deleted (based on past help on the forum). Either I misunderstood or I made a mistake implementing the command.

Before the function is called the item is checked to make sure it is a directory then this function is used to delete the folder.

function deleteFolder(path) {
	DOpus.Output("Deleting folder: " + path);
	cmd.ClearFiles();
	cmd.AddFile(path);
	cmd.Runcommand("Delete FAILNOTEMPTY NORECYCLE QUIET");
}

This function is deleting folders with files in them and the files are larger than 0.

Help, what did I do wrong?

That looks correct, at least.

Can you give a small, self-contained script that demonstrates the problem, and a zip containing a folder structure that doesn't work with it? I'll try to reproduce what you're seeing.

Yes I will do this as soon as I can. It's a busy day. Hopefully, I will have time in the next day or two.

1 Like