Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching with pattern and recursive (LS and FIND) #1623

Closed
wartillo opened this issue Jan 20, 2017 · 8 comments
Closed

Searching with pattern and recursive (LS and FIND) #1623

wartillo opened this issue Jan 20, 2017 · 8 comments

Comments

@wartillo
Copy link

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]

@benhillis
Copy link
Member

This looks like a duplicate of #910.

@wartillo
Copy link
Author

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
Copy link
Author

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

@benhillis
Copy link
Member

@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

@JasonLinMS
Copy link

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.

@wartillo
Copy link
Author

wartillo commented Jan 20, 2017

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.

@benhillis
Copy link
Member

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

@aseering
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants