File-System getEntity --> How do i check if entity is Folder or File?


#1

When i loop through the entities in a folder i get all files and folders. But I cant distinguish between files and folders.
i have tried checking it with file.exists (but both give true).
any ideas ?


#2
if (!fs.Folder.exists(entity.path))
{
isFile = true;
}

please try to enter the path of the folder or file here (entity.path)

if it is not folder then it file.


#3

fs is filesystemModule Nativescript

import * as fs from "tns-core-modules/file-system/file-system";


#4

Thank you. I thought i tried this, but got true in both cases. I must have forgotten o reset the isFIle :frowning: above solution works.
Bert