CMD tree command limit number of levels

前端 未结 6 916
盖世英雄少女心
盖世英雄少女心 2021-02-07 04:18

How do I limit the number of levels that the tree command goes through in Windows? I need to output the results to a text file for work, but because by default the tree command

6条回答
  •  失恋的感觉
    2021-02-07 05:17

    Since I didn't found complete answer here. Here it is:

    Windows CMD doesn't support -L depth levels.

    1. Install CygWin https://www.cygwin.com.
    2. In Cygwin make sure you pick Utilities / Tree package installed.
    3. Open CygWin and navigate to your folder, like cd ../../cygdrive/c/myFolder.
    4. List tree structure and save as result.txt tree -L 3 >result.txt.

提交回复
热议问题