List of files and directory and subdirectories

how can, i list all files in directory and subdirectories, i write some code but not work for me

getFiles(parent,dir,data){
this.file.listDir(parent,dir).then((files)=>{
files.forEach(f1 => {
if(f1.isDirectory == true && f1.name !=’.’ && f1.name !=’…’){
this.totalDirs++;
this.getFiles(f1.fullPath,’’,data);
}else{
this.totalFiles++;
data.push({
name:f1.nativeURL,
});
}
});
}).catch((err) => {
console.log(JSON.stringify(err));
});
}