To get only folders (directories) within a specific location on your computer, you can use various methods depending on the operating system you're using. Here's how you can do it on different platforms:
1. Windows (Command Prompt or PowerShell):
Using Command Prompt:
Open Command Prompt (cmd).
Navigate to the directory where you want to list only folders by using the cd command
.Run the following command to list only directories:
cmd
Copy code
dir /AD
The /AD switch lists only directories (folders).
Using PowerShell:
Open PowerShell.
Navigate to the desired directory using cd.
Run the following command:
powershell
Copy code
Get-ChildItem -Directory
This command lists all directories in the current location.
2. macOS and Linux (Terminal):
Using Terminal:
Open Terminal.
Navigate to the directory where you want to list only folders using the cd command.
Run the following command:
bash
Copy code
ls -d */
The -d option prevents ls from listing the contents of directories, and */ matches only directories.
Alternatively, you can use:
bash
Copy code
find . -maxdepth 1 -type d
This command lists all directories within the current directory. The -maxdepth 1 option limits the search to the current directory level.