On Friday, 14 September 2018 at 15:21:21 UTC, H. S. Teoh wrote:
On Fri, Sep 14, 2018 at 02:36:34PM +0000, Josphe Brigmo via
Digitalmars-d-learn wrote: [...]
It happens on a bunch. I do get errors or overlong file names
but this doesn't seem to be the case.
The fact is, that simply using execute shell using the same
file name works. So this is a D problem.
It happens quite often and every time I can delete the files
in file explorer.
It would really help if you post a stripped-down version of the
code that exhibits the same problem. Otherwise we're just
guessing what the real problem is.
T
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).