Closed matteo-cristino closed 3 weeks ago
I encountered the same recursivity problem with a different code. I also tried to implement a method to make this recursivity work :
function removeDirectoryRecursively( directory )
{
if( fs.existsSync( directory ) )
{
let files = fs.readdirSync( directory, { withFileTypes : true } );
files.forEach( file =>
{
const path = `${directory}/${file.path}`;
const stat = fs.statSync( path );
if( stat.isFile() )
{
fs.rmSync( path );
}
if( stat.isDirectory() )
{
removeDirectoryRecursively( path );
}
} );
files = fs.readdirSync( directory, { withFileTypes : true } );
if( files.length == 0 )
{
fs.rmdirSync( directory );
}
}
}
But even this is returning Directory is not empty
for every directories to remove.
Opened PR #100 that should address the recursively removal
Fixed in #100. Thanks a lot!
Hi there, I'm new to zenFS and I'm testing it for the moment with node, but found out some interesting stuff that may be also of your interest.
This is the code I'm using
with
@zenfs/core@0.16.3
.As written in the comment:
fs.mkdtemp
fails if I firstly do not create the/tmp
directory, maybe this can be done directly in that function if it does not exists?fs.rm
recursive options seems not to works with neseted folders and files