CMD tree command limit number of levels
Since I didn't found complete answer here. Here it is:
Windows CMD doesn't support -L
depth levels.
- Install CygWin https://www.cygwin.com.
- In Cygwin make sure you pick Utilities / Tree package installed.
- Open CygWin and navigate to your folder, like cd
../../cygdrive/c/myFolder
. - List tree structure and save as result.txt
tree -L 3 >result.txt
.
Actually, the tree
command in DOS and Windows does not have the option for specifying the directory level that the command goes through. You can refer to the documentation of tree on Microsoft Docs.
But you can use Git Bash instead. This tool is provided when you install Git for Windows. So in this way, you can use the command that @Zhengquan Feng mentioned.