Search code examples
cmdfindwindowcommand-line-interface

How to find all header files in directory and subdirectories in Windows


i recently started working on windows operation system(2012 R2) and i am trying to find all files with header format (*.h) in my directory and it subdirectories .

this how i got it when i ran in linux shell :

find /auto/sw_work/fwshared/ibrahims/git/svx/pci_verification -name "*.h"   

i got the following results :

/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/BlockStateMainProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/BlueFieldBdfProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/CfgLastIndexProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/CfgLastIndexPropertyProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/ComponentIsUpstreamProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/ConfigTraceProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/DmesgProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/DriverProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/HeaderLogProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/HotPlugProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/I1FrequencyProperty.h
/auto/sw_work/fwshared/ibrahims/git/svx/pci_verification/pci_properties/src/LinkEqProperty.h

how can i get the following results when running in windows command line?

thank in advance .


Solution

  • That's an easy one.

    The command to list files is dir. See dir /? for various switches.

    dir /s /b "\auto\sw_work\fwshared\ibrahims\git\svx\pci_verification\*.h"
    

    The /s switch looks recursive (including subfolders), the /b switch will show the files in bare format (no header, no summary, timestamps or size)

    Note: the directory separator in Windows is \, not / as in Unix/Linux.