remove file access denied(remove broke)

bauss jj_1337 at live.dk
Sat Sep 15 06:13:29 UTC 2018


On Friday, 14 September 2018 at 16:55:21 UTC, Josphe Brigmo wrote:
> On Friday, 14 September 2018 at 15:21:21 UTC, H. S. Teoh wrote:
>> [...]
>
> It woudln't help. I'm dealing with over a million files and 
> you'd need those files too.
>
> But basically all I have done is created a new rename function:
>
> void removeFile(string fn)
> {
> 	if (!isDir(fn))
> 	{
> 		// remove(fn)
> 		setAttributes(fn, 0x80);
> 		auto ls = executeShell(`del /F /Q "`~fn~`"`);
> 		if (ls.status != 0) throw new Exception("Cannot delete file 
> `"~fn~"`!");
> 	}
> }
>
> And this works and functions appropriately.
>
> The other code is basically just recursively going through the 
> directory as standard practice using dirEntries and deleting 
> certain files(it's a little more complex since there is some 
> logic on the file name, but nothing touches the file except 
> delete).

Went ahead and did the following in case anyone comes across your 
issue in the future:

https://github.com/dlang/phobos/pull/6707

That way the documentation will at least be clear about it.


More information about the Digitalmars-d-learn mailing list