Getting all files in phone

i want to work recursively in all directories and getting all files, i write some code but not work for me, i need help

getFiles(dir){
this.file.listDir(dir,’’).then((files)=>{
files.forEach(f1 => {
if(f1.isDirectory == true && f1.name !=’.’ && f1.name !=’…’){
this.getFiles(f1.fullPath.substring(1));
}else{
this.items.push({
name:f1.nativeURL,
});
}
});
});
}