Files without extension are not listed (node-red-contrib-fs)

Files without extension are not listed.

Info :

  • Windows 10
  • NodeRed 1.3.5 and 2 beta 2
  • NodeJs 14.17.3
  • Npm 7.19.1
  • Chrome

What are the settings you are using in the node?

I tried several : *.* , *

Config generated by node-red-contrib-fs

{
	"start": "C:/Delete",
	"pattern": "*.*,.*.*",
	"folders": "*,.*",
	"lstype": "files",
	"hidden": true,
	"path": true,
	"single": true,
	"depth": 0,
	"stat": true
}

Yup I see the problem and note you have added to an existing issue on the GitHub page. If I get some time later today, I'll take a peek in the code.

Thanks. I've not found much time for that node recently. All contributions gratefully received :slight_smile:

A file pattern of *.* probably wouldn't work of course since it is asking for something with a dot in it. Did you try a file pattern of *.

Did you try just *

@Colin in my testing, the only way to list a file with no extension is using the first letter on the file name and an asterisk.

I be looking at the code later today since I dug into it last year.

OK, I didn't realise you had replicated it with just a *. As you say it does seem there is a bug then.

Julian, please add time formatting in milliseconds (same as in fs-ops-stats).
It would simplify the flow, no need for conversion.

Times

I have a question for you. Lets say you have the following files
Screen Shot 2021-07-12 at 3.21.57 PM

What do you think the correct search pattern should be to just return the file noext?

For me, for all files : *.*
With no extension, I think * or *.

hmmm, in Linux using
*.* lists all the non hidden files and no folders
*. generates an error
* lists all non hidden files and folders and their contents

so being consistant with Linux, it should be * and you would have to filter out the ones you don't want,,,,hmmm

Ah, that explains why I put in the test for '' or '' and convert both to '.*' because that is looking for FILES not folders which is separate.

So I think something more complex is needed in order to be able to search just for files even if they don't have an extension - and it needs to work on both Windows and Linux.

I am open to suggestions :slight_smile:

I think I'm just returning what Node.JS's fs library gives aren't I?

I'm open to a PR though.

One thing you can do is use a single * and return the results in separate messages. Then add a switch set up to look and see if the file 'contains' a period like this
Screen Shot 2021-07-13 at 5.03.59 AM
and only pass on what comes out of the 'otherwise'

In bash one can do ls -d !(*.*) which says to only show files without a dot in the name. I suspect that doesn't help here however.

There is a handy npm package which deals very well with pattern matching, and also claims to be Windows compliant.