1

I am using the following command to list all the files (with absolute path) other than the undesired folders.

Just a small problem , i don't want to list just directory name as listed in below first three entries.

C:\Listings\D1
C:\Listings\D2
C:\Listings\D3

How can i do that. Thanks

dir /S /B * | findstr /v /i UD

C:\Listings>dir /S /B * | findstr /v /i UD
C:\Listings\D1
C:\Listings\D2
C:\Listings\D3
C:\Listings\D1\d1_file.txt.txt
C:\Listings\D2\d2_file.txt.txt
C:\Listings\D3\d3_file.txt.txt
2
  • I don't get this result. What is your Windows version?
    – harrymc
    Commented Sep 17, 2020 at 15:57
  • windows version 10
    – csavvy
    Commented Sep 18, 2020 at 10:54

3 Answers 3

1

Add /A-D switch to the command:

dir /A-D /S /B * | findstr /v /i UD

This switch excludes directories (with directory attributes).

1
  • Thanks Wasif, that works
    – csavvy
    Commented Sep 18, 2020 at 3:42
1

And the PowerShell equivalent...
Verbose:

Get-ChildItem -File -Recurse -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName

With aliases:

gci -af -r -ea silent | select -exp FullName

The above starts outputting results immedidately, facilitating further pipeline processing.

The alternate construction:

( gci -af -r -ea silent ).FullName

...completes the recursive query before selecting the FullName property and returning results.

Get-ChildItem/gci

0

One alternative:

where /r . *

Where only list files and with the fullpath:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .