WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Searching with pattern and recursive (LS and FIND)

Open wartillo opened this issue 9 years ago • 8 comments

Hi,

I've been looking into issue but i dont see anything about. Recursive search file dont find anything if i'm looking for a pattern.

Tree, to show files . ├── eula.1041.txt ├── eula.1042.txt ├── eula.2052.txt ├── eula.3082.txt ├── folder1 │   ├── eula.1028.txt │   └── eula.1031.txt └── folder2 ├── eula.1033.txt ├── eula.1036.txt └── eula.1040.txt

ls . -R .: eula.1041.txt eula.1042.txt eula.2052.txt eula.3082.txt folder1 folder2

./folder1: eula.1028.txt eula.1031.txt

./folder2: eula.1033.txt eula.1036.txt eula.1040.txt

With the pattern i just get file from the current folder ls *.txt -R eula.1041.txt eula.1042.txt eula.2052.txt eula.3082.txt

The same thing is happening with find find . . ./eula.1041.txt ./eula.1042.txt ./eula.2052.txt ./eula.3082.txt ./folder1 ./folder1/eula.1028.txt ./folder1/eula.1031.txt ./folder2 ./folder2/eula.1033.txt ./folder2/eula.1036.txt ./folder2/eula.1040.txt

find *.txt eula.1041.txt eula.1042.txt eula.2052.txt eula.3082.txt

Version : Microsoft Windows [version 10.0.14393]

wartillo avatar Jan 20 '17 16:01 wartillo

This looks like a duplicate of #910.

benhillis avatar Jan 20 '17 16:01 benhillis

This is what i was thinking but i've changed the dont_use_nlink value for define or 0 or 2 and still have the same issue.

Well the change is for Perl setting, i dont think that will have an impact for the command line or I missed something in the 910 threat, or maybe i missed something. :)

wartillo avatar Jan 20 '17 16:01 wartillo

By using the perl command is working if i'm setting dont_use_nlink => 'define'

perl -e 'use File::Find;find(sub {print $File::Find::name,$/;},".");' . ./eula.1041.txt ./eula.1042.txt ./eula.2052.txt ./eula.3082.txt ./folder1 ./folder1/eula.1028.txt ./folder1/eula.1031.txt ./folder2 ./folder2/eula.1033.txt ./folder2/eula.1036.txt ./folder2/eula.1040.txt

but that not solve the LS or FIND command

ls *.txt -R eula.1041.txt eula.1042.txt eula.2052.txt eula.3082.txt

wartillo avatar Jan 20 '17 16:01 wartillo

@wartillo - Thanks for the additional info. I tried this on Microsoft Windows [Version 10.0.15014] and this is the output I'm seeing which I believe is correct.

benhill@BENHILL-DELL:/mnt/c/benhill/foo$ mkdir bar
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ mkdir bacon
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ cd bar
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bar$ touch baz1.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bar$ touch baz2.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bar$ cd ..
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ touch baz3.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ cd bacon/
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bacon$ touch baz4.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bacon$ touch baz5.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo/bacon$ cd ..
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ find .
.
./bacon
./bacon/baz4.txt
./bacon/baz5.txt
./bar
./bar/baz1.txt
./bar/baz2.txt
./baz3.txt
benhill@BENHILL-DELL:/mnt/c/benhill/foo$ tree
.
├── bacon
│   ├── baz4.txt
│   └── baz5.txt
├── bar
│   ├── baz1.txt
│   └── baz2.txt
└── baz3.txt

2 directories, 5 files

benhillis avatar Jan 20 '17 17:01 benhillis

Yeah the Perl setting only affects Perl. On the latest Insider build, this issue has already been fixed, or you can wait for the Creators Update.

JasonLinMS avatar Jan 20 '17 18:01 JasonLinMS

OK i think it's maybe about ubuntu and not specific to the bash for windows.

I mean, in powershell the result is complete : PS C:\test> ls *.txt -R

Répertoire : C:\test\folder1

Mode LastWriteTime Length Name


-a---- 2007-11-07 07:00 17734 eula.1028.txt -a---- 2007-11-07 07:00 17734 eula.1031.txt

Répertoire : C:\test\folder2

Mode LastWriteTime Length Name


-a---- 2007-11-07 07:00 10134 eula.1033.txt -a---- 2007-11-07 07:00 17734 eula.1036.txt -a---- 2007-11-07 07:00 17734 eula.1040.txt

Répertoire : C:\test

Mode LastWriteTime Length Name


-a---- 2007-11-07 07:00 118 eula.1041.txt -a---- 2007-11-07 07:00 17734 eula.1042.txt -a---- 2007-11-07 07:00 17734 eula.2052.txt -a---- 2007-11-07 07:00 17734 eula.3082.txt

But in the BASH :

/mnt/c/test# ls -R *.txt eula.1041.txt eula.1042.txt eula.2052.txt eula.3082.txt

I didn't used find command since a long time, i just remeber that for find we need to specify with -name find . -name "*.txt"

My confusion is comming from the powershell and not te bash. :)

I've checked on a ubuntu computer and the result is the same as bash.

wartillo avatar Jan 20 '17 18:01 wartillo

Cool thanks for confirming, I'm going to go ahead and close this out as a duplicate.

benhillis avatar Jan 20 '17 18:01 benhillis

@wartillo -- In Linux (or WSL), try ls -l.

aseering avatar Jan 21 '17 00:01 aseering